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

 採用された回答

Andrei Bobrov
Andrei Bobrov 2013 年 3 月 14 日
編集済み: Andrei Bobrov 2013 年 3 月 14 日

0 投票

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 ??
Andrei Bobrov
Andrei Bobrov 2013 年 3 月 14 日
see Wayne's answer

サインインしてコメントする。

その他の回答 (1 件)

Wayne King
Wayne King 2013 年 3 月 14 日
編集済み: Wayne King 2013 年 3 月 14 日

1 投票

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 Exchange2-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