How to plot three functions in three separate figures and simultaneously in one figure but in three different windows of the same figure?
조회 수: 16 (최근 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!