Plotyy using curves with different sizes
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (1)
Walter Roberson
le 29 Juin 2017
[hAx,hLine1,hLine2] = plotyy([x2,nan,x], [y2,nan,y3], x, y1, 'plot', 'plot');
0 commentaires
Voir également
Catégories
En savoir plus sur Two y-axis dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!