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

plot a graph

x= 0:0.01:25. For y=x^3 – 4x^2 +1 your plot command will be variant of plot(x,y).

Best Answer

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.