How to connect points to create a figure?

2 次查看(过去 30 天)
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.

采纳的回答

Star Strider
Star Strider 2015-11-9
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 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by