How to plot three functions in three separate figures and simultaneously in one figure but in three different windows of the same figure?
15 ビュー (過去 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
0 件のコメント
採用された回答
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
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 Center および File Exchange で Subplots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!