How to plot a polynomial of which I have coefficient vector?
조회 수: 79 (최근 30일)
이전 댓글 표시
I have only coefficient: how to plot it?
댓글 수: 0
답변 (4개)
Walter Roberson
2019년 1월 31일
t = linspace(-10,10); %adjust as needed
plot(t, polyval(a, t)); % where a is coefficients of a polynomial
댓글 수: 0
Jyotish Robin
2018년 2월 8일
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
댓글 수: 0
Timothy Simon Thomas
2020년 6월 3일
편집: Timothy Simon Thomas
2020년 6월 3일
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')
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Polynomials에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!