Effacer les filtres
Effacer les filtres

How do I make my plot show more than one point?

2 vues (au cours des 30 derniers jours)
whyamiincollege
whyamiincollege le 29 Avr 2019
Modifié(e) : Adam Danz le 29 Avr 2019
I think since I'm using a for loop for this it only shows the final point for both graphs, how do I make it show all the points?
if path == 1
for x1 = 0:.2:5
y1 = (x1*2)+2
plot (x1,y1,'c-->')
end
elseif path == 2
for x2 = 0:.2:5
y2 = x2^2
plot (x2,y2,'m:>')
end
end
end

Réponse acceptée

Adam Danz
Adam Danz le 29 Avr 2019
Modifié(e) : Adam Danz le 29 Avr 2019
Use hold . You don't need for-loops.
figure
axes
hold on
path =1;
if path == 1
x1 = 0 : 0.2 : 5;
y1 = (x1.*2)+2;
plot (x1,y1,'c-->')
elseif path == 2
x2 = 0 : .2 : 5;
y2 = x2.^2;
plot (x2,y2,'m:>')
end

Plus de réponses (0)

Catégories

En savoir plus sur Graphics Performance dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by