Find the normal vector at a specific point on a 3D surface defined by an equation

1 回表示 (過去 30 日間)
Diaa
Diaa 2021 年 6 月 21 日
編集済み: Diaa 2021 年 6 月 21 日
Consider the following code:
rng('default')
[Xs,Ys,Zs] = sphere;
X = (0.99+0.01*rand(size(Xs))).*Xs;
Y = (0.99+0.01*rand(size(Ys))).*Ys;
Z = (0.99+0.01*rand(size(Zs))).*Zs;
noVertcs = 5;
xdata = X(1:noVertcs,1:noVertcs);
ydata = Y(1:noVertcs,1:noVertcs);
zdata = Z(1:noVertcs,1:noVertcs);
ft = fittype(...
'a*x^3 + b*y^3 + c' ...
,'independent', {'x','y'} ...
,'dependent',{'z'} ...
,'coefficients',{'a','b','c'}...
);
[XOut, YOut, ZOut] = prepareSurfaceData(xdata, ydata, zdata);
SurFit = fit( [XOut, YOut] , ZOut , ft );
plot(SurFit)
I need to make a code that takes x, y, z coordinates of some certain point on the surface created by SurFit, then it returns the components and the direction cosines of the normal vector at this specific point.

回答 (0 件)

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by