How to connect points to create a figure?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Chris Lambrecht
le 9 Nov 2015
Réponse apportée : Star Strider
le 9 Nov 2015
I am given a figure that has points of (0,0), (0,3), and (0,4) and when connecting those points the resulting figure should be a right triangle, however, I am using scatter and lines and am only getting only two lines and an open bottom. What would be the easiest way to plot this so that the figure can be closed and I get that right triangle from the plot.
0 commentaires
Réponse acceptée
Star Strider
le 9 Nov 2015
I just got a straight line with the values you posted. The trick to closing the triangle is to repeat the first set of points (here (0,0)) at the end of the x and y vectors:
x = [0 0 4 0];
y = [0 3 3 0];
figure(1)
plot(x, y)
axis([-1 5 -1 5])
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!