Plotting data on existing plot
2 ビュー (過去 30 日間)
古いコメントを表示
I have this code, in which I want the data to plot on a single figure, however they all plotted seperately. I need assistance on making all the data plot on a single figure.
swvec(1)=0.1;
swvec(2)=0.2;
swvec(3)=0.3;
for i=1:3
a= swvec(i);
theta = [0 30 60 90];
b = (1/a);
v1 = sind(theta).*a;
v2 = cosd(theta).*a;
figure
plot (v1,v2)
hold on
swvec(3)
hold off
end
0 件のコメント
回答 (1 件)
the cyclist
2015 年 2 月 23 日
編集済み: the cyclist
2015 年 2 月 23 日
Pull the figure and hold commands out of the for loop:
swvec(1)=0.1;
swvec(2)=0.2;
swvec(3)=0.3;
figure
hold on
for i=1:3
a= swvec(i);
theta = [0 30 60 90];
b = (1/a);
v1 = sind(theta).*a;
v2 = cosd(theta).*a;
plot (v1,v2)
swvec(3)
end
hold off
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!