How to plot three functions in three separate figures and simultaneously in one figure but in three different windows of the same figure?

13 次查看(过去 30 天)
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

采纳的回答

Johannes Hougaard
Johannes Hougaard 2020-7-23
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])]);

更多回答(1 个)

Bjorn Gustavsson
Bjorn Gustavsson 2020-7-23
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

类别

Help CenterFile Exchange 中查找有关 Graphics Object Properties 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by