【发布时间】:2015-10-01 17:45:28
【问题描述】:
三角形的顶点在tri = [1 2 2 1; 1 2 -2 1]中给出
我看到 tri 有 4 列和 2 行,但是它们是如何定义顶点的呢?
tri中定义的顶点是什么以及如何在Matlab中绘制它们?
【问题讨论】:
-
请给出更多解释?你是说三元组吗?
标签: matlab plot matlab-figure
三角形的顶点在tri = [1 2 2 1; 1 2 -2 1]中给出
我看到 tri 有 4 列和 2 行,但是它们是如何定义顶点的呢?
tri中定义的顶点是什么以及如何在Matlab中绘制它们?
【问题讨论】:
标签: matlab plot matlab-figure
在您的tri 变量中,最后一个顶点与第一个顶点相同。如果您希望在使用plot 时关闭三角形,这是有道理的。比较以下:
tri = [1 2 2; 1 2 -2]; %// just the three vertices
plot(tri(1,:), tri(2,:), 'linewidth', 1)
axis([0 3 -3 3])
tri = [1 2 2 1; 1 2 -2 1]; %// first vertex is repeated to "close" the plot
plot(tri(1,:), tri(2,:), 'linewidth', 1)
axis([0 3 -3 3])
【讨论】: