필터 지우기
필터 지우기

Merge number of curves

조회 수: 2 (최근 30일)
Aleksandr Bashkatov
Aleksandr Bashkatov 2018년 3월 10일
댓글: Star Strider 2018년 3월 11일
Dear MathWorks community,
Thanks for your time in advance.
I have a number of curves (for example 4) with the same Y range, but different range along X axis.
Problem: I would like to arrange it one after another into one Figure. It means that X axis should be divided into four parts and each parts should have its own x range. All of the parts should be at the same X axis. Just to be more clear: It should looks like one Figure with one Y axis and four X axis that follow each other.
In the attachments you can see an idea how it should works (more or less).
If you have any idea, I would be really happy. Many thanks!

채택된 답변

Star Strider
Star Strider 2018년 3월 10일
Try this:
t1 = linspace(0, 6, 500); % Create Independent Variable Data
t2 = linspace(0, 11, 500);
t3 = linspace(0, 16, 500);
s1 = sin(25*pi*t1) .* exp(-0.5*t1); % Create Dependent Variable Data
s2 = sin(15*pi*t2) .* exp(-0.3*t2);
s3 = sin(10*pi*t3) .* exp(-0.2*t3);
xtv = [max(t1) max(t2) max(t3)]; % Define Section Limits
figure(1)
plot(t1, s1) % Plot Signal 1
hold on
plot(t2+xtv(1), s2) % Plot Signal 2
plot(t3+xtv(1)+xtv(2), s3) % Plot Signal 3
YL = ylim;
plot(cumsum([xtv(1:2); xtv(1:2)],2), YL(:)*[1 1], '--k', 'LineWidth',1) % Plot Vertical Separation Lines
hold off
set(gca, 'XLim',[0 sum(xtv)]); % Define X-Axis Limits
xtix = [(0:xtv(1)-1) (0:xtv(2)-1) (0:xtv(3))]; % Define Tick Labels
set(gca, 'XTick',linspace(0, 1, numel(xtix))*(sum(xtv)), 'XTickLabel',xtix, 'FontSize',8) % Plot Tick Labels
Experiment to get the result you want.
  댓글 수: 2
Aleksandr Bashkatov
Aleksandr Bashkatov 2018년 3월 11일
Many thanks!
Star Strider
Star Strider 2018년 3월 11일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by