How to plot the function f(x)=x^3 - 4x^2 +1 for x∈[0,25]

10 Ansichten (letzte 30 Tage)
Potatopao
Potatopao am 14 Apr. 2015
Bearbeitet: pfb am 14 Apr. 2015
x= 0:0.01:25. For y=x^3 - 4x^2 +1 your plot command will be variant of plot(x,y).

Akzeptierte Antwort

pfb
pfb am 14 Apr. 2015
You almost got it. Since x is a vector, you should use elementwise operators. not x^2 (what's the square of a vector?) but x.^2.
  1 Kommentar
pfb
pfb am 14 Apr. 2015
Bearbeitet: pfb am 14 Apr. 2015
also, you should write the multiplication operator (*) explicitly
x= 0:0.01:25
y=x.^3 - 4*x.^2 +1;
plot(x,y);

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by