How can I connect points from different plots
Afficher commentaires plus anciens
I created three different sets of points on a graph, now I want to connect those points with one line, but I don't know how to do this since they are different sets. Does anyone have an idea?
x1= [2:10:300];
n1=[0:6:179]
y1=[n1];
x2= [4:10:300];
n2=[2:6:179];
y2=[n2];
x3= [6:10:300];
n3 = [2:6:179]
y3=[n3]
plot(x1,y1,'o')
hold on
plot(x2,y2,'o')
plot(x3,y3,'o')
Réponses (1)
KALYAN ACHARJYA
le 13 Mar 2019
Modifié(e) : KALYAN ACHARJYA
le 13 Mar 2019
Use the following line at last in the code-
line([x1,x2,x3],[y1,y2,y3],'Color', 'b');

5 commentaires
madhan ravi
le 13 Mar 2019
x1= [2:10:300];
% ^--------^----- are superfluos!
KALYAN ACHARJYA
le 13 Mar 2019
@Madhan ravi Sir I didnot check the code. Thanks for pointing.
Joyce de Heer
le 13 Mar 2019
KALYAN ACHARJYA
le 13 Mar 2019
Modifié(e) : KALYAN ACHARJYA
le 13 Mar 2019
Use the following with different colors
line(x1,y1,'color','y');
line(x2,y2,'color','m');
line(x3,y3,'color','b');
Joyce de Heer
le 13 Mar 2019
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!