Plotting data created from a for loop

1 vue (au cours des 30 derniers jours)
David Anthony
David Anthony le 23 Avr 2017
Commenté : Stephen23 le 26 Avr 2017
I'm trying to plot data created from a for loop.
x1 = ns;
y1 = r;
x2 = ns2;
y2 = r2;
sz1 = 10;
sz2 = 30;
c = 'k';
scatter(x1,y1,sz1,c,'filled');
hold on;
scatter(x2,y2,sz2,c,'filled');
hold on;
line(x1,x2);
hold on;
line(y1,y2);
xlim([0.89 1.01])
ylim([0 0.8])
Where ns, r, ns2 and r2 are data created from a for loop (n=1:5).
The code words fine without the lines, plotting all the data points, but I would like to create a set colour for every n (as opposed to a gradient), and join up each x1,x2 and y1,y2 separately for every n. At the moment, the lines go crazy and try to join everything up, and I have no idea how I'd set a separate colour for every n.
How would I achieve this?
Thanks

Réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by