필터 지우기
필터 지우기

yyaxis plot joining start and end points with a straight line

조회 수: 3 (최근 30일)
Binay Chandra
Binay Chandra 2018년 3월 27일
댓글: Binay Chandra 2018년 3월 27일
Hi All, I am plotting two signals using yyaxis which has the same time span, but while plotting it is joining start and end points of both the signals with a straight line which is kind of strange behaviour. But for some of the channels it is plotting perfectly.
I tried with removing all nan values but no luck. Checked size of both the signals and all are same. I am not able to find any properties that might have been accidently set. Code snippet below,
yyaxis left;
cla(axesHome, 'reset');
plot(axesHome, time, singal_1, 'LineWidth',1.5); grid on;
yyaxis right;
plot(axesHome, time, signal_2, 'LineWidth',1.5); grid on;
Please help.

채택된 답변

Rik
Rik 2018년 3월 27일
Because I don't have your data I can't check this, but it might be the case that your data is not well-sorted, so plot results in an unexpected straight line. The code below should ensure this is not the case.
yyaxis left;
cla(axesHome, 'reset');
[temp_time,order]=sort(time);
plot(axesHome, temp_time, singal_1(order), 'LineWidth',1.5); grid on;
yyaxis right;
plot(axesHome, temp_time, signal_2(order), 'LineWidth',1.5); grid on;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by