How to plot three functions in three separate figures and simultaneously in one figure but in three different windows of the same figure?
16 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Asif Rashid
am 23 Jul. 2020
Kommentiert: Asif Rashid
am 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 Kommentare
Akzeptierte Antwort
Johannes Hougaard
am 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])]);
Weitere Antworten (1)
Bjorn Gustavsson
am 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
Siehe auch
Kategorien
Mehr zu Subplots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!