i got an error when i run this code ?

1 次查看(过去 30 天)
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

采纳的回答

Andrei Bobrov
Andrei Bobrov 2013-3-14
编辑:Andrei Bobrov 2013-3-14
k = 1:5;
x = 1:100;
y = k'*log(x);
plot(x,y);
  2 个评论
mohamed
mohamed 2013-3-14
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)

类别

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by