필터 지우기
필터 지우기

Plotting graph in matlab

조회 수: 1 (최근 30일)
tyler brecht
tyler brecht 2014년 10월 26일
답변: Star Strider 2014년 10월 26일
Hi guys.
How do I plot two graphs on one axis but not to overlap each other? Is this possible?

답변 (3개)

Rick Rosson
Rick Rosson 2014년 10월 26일
You can plot them on one set of axes, but then they are going to overlap:
figure;
plot(t,x,t,y);
Or you can plot them on two sets of axes in a single figure window:
figure;
subplot(2,1,1);
plot(t,x);
subplot(2,1,2);
plot(t,y);
  댓글 수: 1
tyler brecht
tyler brecht 2014년 10월 26일
Okay, is it then possible to move the position of the x-axis of one graph e.g like from 0 to 6 and keep the x-axis of the other plot at 0

댓글을 달려면 로그인하십시오.


Rick Rosson
Rick Rosson 2014년 10월 26일
figure;
plot(t,x,t+6,y);

Star Strider
Star Strider 2014년 10월 26일
I am not certain what you want. We can probably change this plot to do what you want if this isn’t it:
x = [linspace(0,6,25); linspace(0,6,25)];
y = [exp(0.5*x(1,:)); x(2,:).^2];
xs = bsxfun(@plus, x, [0; 7]);
figure(1)
plot(xs', y')
grid
xlb = [0:6 0:6];
xtk = 0:length(xlb)-1;
set(gca, 'XTick',xtk, 'XTickLabel',xlb)
legend('\itf\rm(\itx\rm) = \ite\rm^{0.5 \itx}', '\itf\rm(\itx\rm) = \itx^2', 'Location', 'NW')
produces:

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by