i got an error when i run this code ?

x=(1:100); for k=1:5 y(:,k)=k*log(x); end plot(x,y)
the error is in the third line? i want to make a single plot for different values of k

 采纳的回答

k = 1:5;
x = 1:100;
y = k'*log(x);
plot(x,y);

2 个评论

you really got what i want but did you find the error in my code ??

请先登录,再进行评论。

更多回答(1 个)

Wayne King
Wayne King 2013-3-14
编辑:Wayne King 2013-3-14
x=(1:100); for k=1:5 y(:,k)=k*log(x); end, plot(x,y)
You forgot a semicolon, or comma after end
or better yet:
x=(1:100);
for k=1:5
y(:,k)=k*log(x);
end
plot(x,y)

类别

帮助中心File Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by