How to plot a number of curves on the same plot ?
    4 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
want to plot i number of curves on the same X axis and Y axis and label each curve with a number ? how to do this? Thx in Advance
0 comentarios
Respuesta aceptada
  Azzi Abdelmalek
      
      
 el 9 de Feb. de 2013
        
      Editada: Azzi Abdelmalek
      
      
 el 9 de Feb. de 2013
  
      %Example
x=0:0.1:10;
y1=sin(x);
y2=cos(x)
plot(x,y1,'r',x,y2,'g');
legend({'curv1','curv2'})
Look at
doc plot
0 comentarios
Más respuestas (2)
  Image Analyst
      
      
 el 9 de Feb. de 2013
        You can put your plotting in a "for" loop. At each iteration, just plot your additional curve. You actually can do it without a loop if you just want to plot all the things and have them all already. Just make sure you call "hold on" after the first one, otherwise subsequent plots will blow away the earlier plots.
plot(x1,y1);
hold on;
plot(x2,y2);
plot(x3,y3);
plot(x4,y4);
0 comentarios
  Shashank Prasanna
    
 el 9 de Feb. de 2013
        I prefer using LINE instead of PLOT since plot tends to reset some properties which maybe unexpected and undesirable.
   >> x = 0:2*pi*10;
   >> x = 0:0.01:2*pi*10;
   >> y1 = sin(x);
   >> y2 = cos(x);
   >> line(x,y1,'LineStyle','-','Color','r')
   >> line(x,y2,'LineStyle','.','Color','b')
0 comentarios
Ver también
Categorías
				Más información sobre Annotations en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



