How to plot several graphs in a loop?
3 ビュー (過去 30 日間)
古いコメントを表示
I wouldl ike to generate multiple graphs from my loop. Here is the code I have so far:

I am trying to graph (time vs normal acceleration) and (time vs tangential acceleration) for each a_value(i.e iteration).
I was wondering if I could get 4 different graphs by placing the respective part of the code inside either loop.
In the end I would be able to see 4 different plots generated by each iteration.
2 件のコメント
Rik
2019 年 4 月 11 日
I suspect you might find subplot helpful, but I don't fully understand what you mean.
Also, why did you post your code as an image? Just use the markup provided by the editor here. Then we can copy your code and run it.
回答 (1 件)
Quentin Derville
2021 年 12 月 3 日
Try this code, it may be helpful
f1 = figure;
f2 = figure;
for k = 1:3
% sin kx plot
figure(f1)
plot(x,sin(k*x))
hold on
% cos kx plot
figure(f2)
plot(x,cos(k*x))
hold on
end
figure(f1)
title('Sinus')
figure(f2)
title('Cosinus')
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!