How to plot several graphs in a loop?
3 views (last 30 days)
Show older comments
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 Comments
Rik
on 11 Apr 2019
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.
Answers (1)
Quentin Derville
on 3 Dec 2021
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 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!