Filter löschen
Filter löschen

Plotyy using curves with different sizes

1 Ansicht (letzte 30 Tage)
Josh
Josh am 29 Jun. 2017
Beantwortet: Walter Roberson am 29 Jun. 2017
I am trying to create a figure with multiple curves on the left axis and one curve on the right axis. The curves on the left axis each have their own set of x values.
I can plot all the data on the figure using the code below, but it connects the ends of each curve so there are extra lines I don't want.
figure
x=0:0.1:10;
x2=0:0.2:10;
y1=-x;
y2=5*x2.^2/1000;
y3=1.2*x.^2/1000;
[hAx,hLine1,hLine2] = plotyy([x2,x],[y2,y3],x,y1,'plot','plot');
Using the suggestion in this answer(https://www.mathworks.com/matlabcentral/answers/243650-plotyy-making-extra-lines) I am getting an error using horizcat dimensions of matrices being concatenated are not consistent, and nothing plots. Is there a way I can successfully plot the above using plotyy?
Using version R2015b
Thanks

Antworten (1)

Walter Roberson
Walter Roberson am 29 Jun. 2017
[hAx,hLine1,hLine2] = plotyy([x2,nan,x], [y2,nan,y3], x, y1, 'plot', 'plot');

Kategorien

Mehr zu Two y-axis finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by