Help me about plot and linspace in matlab ?

69 次查看(过去 30 天)
for example I plot the graph y = 2/x by plot command :
x = linspace(1,10,100);
y = 2./x;
plot(x,y,'linewidth',4,'color','r')
It run normally and doesn't have error. But now I plot the graph y = (2/x)^3 by plot:
x = linspace(1,10,100);
y = (2./x)^3;
plot(x,y,'linewidth',4,'color','r')
It appear the error : ??? Error using ==> mpower Inputs must be a scalar and a square matrix. Help me fix it. I think I put the dot wrong. thanks very much.

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2013-12-25
It should be
x = linspace(1,10,100);
y = (2./x).^3;
plot(x,y,'linewidth',4,'color','r')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by