Find the normal vector at a specific point on a 3D surface defined by an equation
8 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!