How to plot three functions in three separate figures and simultaneously in one figure but in three different windows of the same figure?
16 views (last 30 days)
Show older comments
Asif Rashid
on 23 Jul 2020
Commented: Asif Rashid
on 23 Jul 2020
Hello Sir, I want to plot three functions (A,B and C) against z in three seperate figures. Please tell me the possible code.
A=function 1 (y axis)
B=function 2 (y axis)
C= function 3 (y axis )
z on x-axis
Also please tell me , how to create three seperate figures in just one window so that plotts can be seen in one figure but in three different windows of the same one figure. Thankyou for your guidance
0 Comments
Accepted Answer
Johannes Hougaard
on 23 Jul 2020
Look in the documentation for the function subplot
figure;
subplot(3, 1, 1);
plot(z,A);
subplot(3, 1, 2);
plot(z,B);
subplot(3, 1, 3);
plot(z,C);
if A, B, and C are functions (.m files) rather than variables it may be that the code you should use is
figure;
subplot(3, 1, 1);
fplot(@A,[min(z) max(z])]);
subplot(3, 1, 2);
fplot(@B,[min(z) max(z])]);
subplot(3, 1, 3);
fplot(@C,[min(z) max(z])]);
More Answers (1)
Bjorn Gustavsson
on 23 Jul 2020
When you create figures you can do something like this:
fig1 = figure;
fig2 = figure;
fig3 = figure;
Then when you want to plot in a specific figure, lets say figure #2 you do this:
figure(fig2)
plot(x,y)
to plot in multiple axes (matlab-notation for panels to plot in) you have the subplot function, see help and documentation for that function. The elementary use works like this:
subplot(2,2,1)
plot(x,y)
HTH
See Also
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!