Filter löschen
Filter löschen

yyaxis plot joining start and end points with a straight line

3 Ansichten (letzte 30 Tage)
Binay Chandra
Binay Chandra am 27 Mär. 2018
Kommentiert: Binay Chandra am 27 Mär. 2018
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.

Akzeptierte Antwort

Rik
Rik am 27 Mär. 2018
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;

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by