Plot for different value of a
    2 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    Atom
 le 18 Déc 2012
  
    
    
    
    
    Commenté : ABDUL RAZAK BIN NAINA MOHAMED
 le 29 Sep 2019
                  x = [-2:0.1:2];
      z=x.*(a-x^2);
    plot(x,z)
I want to plot(x, z) for four values of a = .5, 1, 1.3, 1.95. How to code it without writing same programme for different a four times.
0 commentaires
Réponse acceptée
  John Petersen
      
 le 18 Déc 2012
        
      Modifié(e) : John Petersen
      
 le 18 Déc 2012
  
      x = [-2:0.1:2];
a = [.5, 1, 1.3, 1.95];
figure;
for i=1:length(a)
    z = x.*(a(i)-x.^2);
    plot(x,z);hold on;
end
1 commentaire
  ABDUL RAZAK BIN NAINA MOHAMED
 le 29 Sep 2019
				how to give different color for each plot for this case
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

