how to plot a graph of the equation (x^5)+(x^4​)+(x^3)+(9​*x^2)+8*x+​3

7 vues (au cours des 30 derniers jours)
jey sun
jey sun le 26 Mar 2014
Modifié(e) : Joseph Cheng le 26 Mar 2014
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')

Réponses (3)

Azzi Abdelmalek
Azzi Abdelmalek le 26 Mar 2014
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 le 26 Mar 2014
>> ezplot(' (x^5)+(x^4)+(x^3)+(9*x^2)+8*x+3')

Joseph Cheng
Joseph Cheng le 26 Mar 2014
Modifié(e) : Joseph Cheng le 26 Mar 2014
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

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by