How to connect points to create a figure?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Chris Lambrecht
il 9 Nov 2015
Risposto: Star Strider
il 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 Commenti
Risposta accettata
Star Strider
il 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Annotations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!