0

我有这个等式:

f(t) = <x(t),y(t)>

我首先想做的是找出某个点的法线向量 t1。如何在 MATLAB 中执行此操作?

然后我想在 MATLAB 中计算出法线向量和 x 轴之间的角度。如果我可以绕过寻找法线向量而直接从 f(t) 中找出角度,那可能会更好。

如果有一些向量操作函数或者我可以使用的东西,而不是手动获取 x(t) 和 y(t) 的导数,然后找到大小和所有这些东西,那就太好了。任何帮助都会很棒!

4

1 回答 1

0

作为dx的时间导数x,即(x(t+1)-x(t-1))/(2dt)(当然也可以使用前向微分代替中心差分),以及dy的相应时间导数y,您可以从向量 [dx 轻松找到法线与 x 轴之间的角度,dy],因为它的正常值只是 [-dy,dx]。

假设 n×1 数组xy坐标,您可以按如下方式执行此操作:

%# take the time derivative
dx = (x(3:end)-x(1:end-2))/2;
dy = (y(3:end)-y(1:end-2))/2;

%# create the normal vector
nvec = [-dy,dx];

%# normalize the normal vector
nvecN = bsxfun(@rdivide,nvec,sqrt(sum(nvec.^2,2)));

%# take the arc-cosine to get the angle in degrees (acos for radian)
%# of the projection of the normal vector onto the x-axis
angle = acosd(nvecN(:,1));
于 2012-12-02T19:50:03.300 回答