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

18 次查看(过去 30 天)
x= 0:0.01:25. For y=x^3 - 4x^2 +1 your plot command will be variant of plot(x,y).

采纳的回答

pfb
pfb 2015-4-14
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 个评论
pfb
pfb 2015-4-14
编辑:pfb 2015-4-14
also, you should write the multiplication operator (*) explicitly
x= 0:0.01:25
y=x.^3 - 4*x.^2 +1;
plot(x,y);

请先登录,再进行评论。

更多回答(0 个)

类别

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