Plot a plane or line in 3D

版本 1.1.0.0 (7.4 KB) 作者: Calvin Price
User specifies two independent vectors, and the corresponding plane is graphed.
5.3K 次下载
更新时间 2008/12/26

无许可证

The user supplies two independent 3x1 vectors, and output is a graph of the plane generated by these two vectors. A single input of one 3x2 matrix is also ok.

The user may specify just one vector. The plot will
then be just the line generated by that vector.

The plot will also be a line if the two input vectors are linearly
dependent.

Optional 3rd argument: User may also specify a string that determines the plot style of the plane, using the same string options as for MATLAB's plot function.

OTHER FUNCTIONS REQUIRED: arrow3D.m (by Shawn Arseneau), column3D.m, scatter3_2.m, normalize.m, rotatePoints.m
(all of these are included in zip file)

EXAMPLE: >> plotp([1;1;1],[2;2;-4])
>> plotp([1;1;1],[3;-3;0],'m')

EXAMPLE: for matrix of rank 1, plot the 2 dimensional nullspace (a plane), and 1 dimensional row space (a line), the two should be visibly orthogonal subspaces

>> A=[1 0 0; 2 0 0; 3 0 0]

A =

1 0 0
2 0 0
3 0 0

>> hold on
>> plotp(null(A))
>> plotp(orth(A'),'m')

引用格式

Calvin Price (2026). Plot a plane or line in 3D (https://ww2.mathworks.cn/matlabcentral/fileexchange/22158-plot-a-plane-or-line-in-3d), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2008b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Surfaces, Volumes, and Polygons 的更多信息
版本 已发布 发行说明
1.1.0.0

Added "rotatePoints.m" into zip file; file is needed for arrow3D.m (by Shawn Arseneau)

1.0.0.0