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')

回答(3 个)

Azzi Abdelmalek
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')

Sean de Wolski
Sean de Wolski 2014-3-26
>> ezplot(' (x^5)+(x^4)+(x^3)+(9*x^2)+8*x+3')

Joseph Cheng
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

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by