How to plot a polynomial of which I have coefficient vector?

202 visualizaciones (últimos 30 días)
Luigi Treccozzi
Luigi Treccozzi el 30 de En. de 2018
Editada: Timothy Simon Thomas el 3 de Jun. de 2020
I have only coefficient: how to plot it?

Respuestas (4)

Walter Roberson
Walter Roberson el 31 de En. de 2019
t = linspace(-10,10); %adjust as needed
plot(t, polyval(a, t)); % where a is coefficients of a polynomial

madhan ravi
madhan ravi el 31 de En. de 2019
fplot(poly2sym(a)) % where a is coefficients of a polynomial

Jyotish Robin
Jyotish Robin el 8 de Feb. de 2018
Hi Luigi,
Hopefully, the command 'fplot' can be helpful. For example,
a=[1 2 3]; % coefficients
fplot(@(x) a(1)*x+ a(2)*(x .^2)+a(3)*(x.^3))
will plot a polynomial function in x.
Hope this helps!
Thanks,
Jyotish

Timothy Simon Thomas
Timothy Simon Thomas el 3 de Jun. de 2020
Editada: Timothy Simon Thomas el 3 de Jun. de 2020
Config
s=10
t=[-s:0.00001:s];
x=t;
Parameters
a=1
b=-6
c=11
d=-6
Equation
fx=(a*(x.^3)) + (b*(x.^2)) + (c.*x) + d;
syms x1
fx1=(a*(x1.^3)) + (b*(x1.^2)) + (c.*x1) + d;
solve(fx1==0,x1)
Plotting
plot(t,fx)
axis([-s,s,-s^2,s^2])
Draw Axes
line([0 0],[-s^2 s^2])
line([-s s],[0 0])
title('Cubic and lower Polynomial Visualiation')

Categorías

Más información sobre Polynomials en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by