Borrar filtros
Borrar filtros

Plotyy using curves with different sizes

1 visualización (últimos 30 días)
Josh
Josh el 29 de Jun. de 2017
Respondida: Walter Roberson el 29 de Jun. de 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

Respuestas (1)

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

Categorías

Más información sobre Two y-axis en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by