Plotting graph using M-file.

7 ビュー (過去 30 日間)
Shantanu K
Shantanu K 2013 年 3 月 1 日
I want to plot graph of x Vs y. So when i do below steps its showing me error as Too many input arguments. So please let me know if you have any idea about this.
for i = 1:10:100
y=i+2;
t=y^2+4;
x(i) = (2*t-1);
k(i)=y+1;
end
plot (x(i),y(i))
I
  4 件のコメント
kash
kash 2013 年 3 月 1 日
the reason i sthe value x has more values than y ,y has single value,use plot inside loop
Shantanu K
Shantanu K 2013 年 3 月 1 日
i tried by using plot inside loop command still its showing error.

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

採用された回答

kash
kash 2013 年 3 月 1 日
編集済み: kash 2013 年 3 月 1 日
Try this
for i = 1:10:100
y=i+2;
t=y^2+4;
x(i) = (2*t-1);
k(i)=y+1;
bar(x,y)
end
  1 件のコメント
Shantanu K
Shantanu K 2013 年 3 月 1 日
編集済み: Shantanu K 2013 年 3 月 1 日
Thanks Kash for your answer but i want it in x Vs y format only....so if you know any other way please let me know. I am doing this program in m-file so i want this to work in mfile

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

その他の回答 (1 件)

ChristianW
ChristianW 2013 年 3 月 1 日
k = 0;
for m = 1:10:100
k = k+1;
y(k)=m+2;
t=y(k)^2+4;
x(k) = (2*t-1);
end
plot(x,y)
  3 件のコメント
ChristianW
ChristianW 2013 年 3 月 1 日
Copy/Paste it to a new m-file, save and run it.
kash
kash 2013 年 3 月 1 日
It works fine in my system,datas are plotted

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

カテゴリ

Help Center および 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