Problem with plotting two lines on the same graph using different line types.
Afficher commentaires plus anciens
I was assigned a problem asking to plot two "butterfly plots". I am to plot two lines on one graph one using a solid line and the other using a dotted line. I have tried using plot(x,t,'-',y,t,':'). and I have tried them separately with the hold on command to not lose the existing data. Either way I can not get the dotted line to appear on the plot. Does Matlab have an override for plots containing too many data points. The code so far looks like this:
t=0:.0625:100; x=sin(t')*(exp(cos(t))-2*cos(4*t)-sin(t/12).^5); y=cos(t')*(exp(cos(t))-2*cos(4*t)-sin(t/12).^5); subplot(2,1,1),plot(x,t,'-'),hold on,plot(y,t,':'),hold off legend('x','y'),hleg1=legend('x','y'),set(hleg1,'Location','EastOutside') title('x and y versus t') xlabel('values of x and y') ylabel('values of t') hold off subplot(2,1,2),plot(y,x) title('y versus x') xlabel('values of y'),ylabel('values of x') axis square
Any help or suggestions would be greatly appreciated.
1 commentaire
Andrew Newell
le 23 Jan 2012
My first suggestion is to format your code so it is readable: see http://www.mathworks.com/matlabcentral/answers/7885-tutorial-how-to-format-your-question.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Line Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!