Connecting final and initial point in simple x-y plot (Plotting closed curve/polygon)

后端 未结 3 726
情歌与酒
情歌与酒 2021-01-12 20:39

Say, for example, I had ...

x = [1 1 2 2];
y = [1 2 2 1];
plot(x, y, \'b-\');

I will get a plot with lines connecting the points (1,1), (1,

3条回答
  •  借酒劲吻你
    2021-01-12 21:13

    Unless your final and last points are the same then plot won't know that you want a closed curve. So either add an additional point to your list to plot or try using, for example, rectangle.

提交回复
热议问题