how to plot a graph of the equation (x^5)+(x^4)+(x^3)+(9*x^2)+8*x+3
조회 수: 7 (최근 30일)
이전 댓글 표시
how to plot a graph of the equation (x^5)+(x^4)+(x^3)+(9*x^2)+8*x+3 in matlab, i have tried using the plot function but it is still not working out. i also need it in the range of -8<x<6
i have used x[-8:1:6] and y=(x^5)+(x^4)+(x^3)+(9*x^2)+8*x+3 plot (x,y,'r')
댓글 수: 0
답변 (3개)
Azzi Abdelmalek
2014년 3월 26일
coeff=[1 1 1 9 8 3] % the coefficients of your polynomial
x=-8:0.1:6
y=polyval(coeff,x)
plot(x,y,'r')
댓글 수: 0
Joseph Cheng
2014년 3월 26일
편집: Joseph Cheng
2014년 3월 26일
You'll need to include the element-wise power in your y equation. instead of just ^ you will need to use .^
y=(x.^5)+(x.^4)+(x.^3)+(9*x.^2)+8*x+3
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!