简体   繁体   English

在Matlab中将法线向量绘制到平面

[英]Plotting a normal vector to a plane in matlab

I'm trying to plot a vector normal to a plane but it doesn't show up as normal.This is the code 我正在尝试绘制垂直于平面的矢量,但是它没有显示为法线。这是代码

[X,Y]=meshgrid(-10:1:10); R=5+2*(X-4)+4*(Y-2); mesh(X,Y,R) hold quiver3(4,2,5,2,4,-1) hold off

What am I doing wrong? 我究竟做错了什么?

The vector is normal to the plane. 向量垂直于平面。 The problem is most likely the automatic axis scaling. 问题很可能是自动轴缩放。

缩放错误

Use axis equal to ensure that data units have the same length along each axis. 使用axis equal以确保数据单元沿每个轴的长度相同。

[X,Y]=meshgrid(-10:1:10);
R=5+2*(X-4)+4*(Y-2);
mesh(X,Y,R)
hold
quiver3(4,2,5,2,4,-1)
hold off
axis equal

正确缩放

With proper axis scaling, your normal vector will appear normal to the plane. 使用适当的轴缩放比例,法线向量将显示为垂直于平面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM