I want to draw two figure in same figure window for comparison purpose.
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi
I want to draw two figure in same figure window for comparison purpose of two different numerical scheme.
The problem is that I can execute code for one scheme at a time in the same script file Graphs are drawn Then I want draw graph in the same figure window when I execute code for next scheme in the same script file.
Please suggest me some way for that.
답변 (1개)
Yazan
2021년 7월 18일
See the example below if you want to draw data on the same axes:
% first signal
t = 0:127;
x = cos(2*pi*0.01*t);
% create a figure and axes
% hold the axes
f = figure; ax = axes(f); hold(ax, 'on')
plot(ax, x), grid(ax, 'minor')
% second signal
x = cos(2*pi*0.05*t);
% plot on the same axes
plot(ax, x)
legend(ax, {'Signal 1', 'Signal 2'})
If you want to draw on different axes, then use subplot:
t = 0:127;
x = cos(2*pi*0.01*t);
% first set of axes
subplot(1,2,1);
plot(x), grid('minor');
x = cos(2*pi*0.05*t);
% second set of axes
subplot(1,2,2);
plot(x), grid('minor');
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Subplots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!