How do I find intersection of a straight line and a surface?
21 次查看(过去 30 天)
显示 更早的评论
I have a surface generated via 'fit' function and a straight line which intersects the surface, how do i find this intersection?
Thanks
0 个评论
回答(1 个)
Matt J
2017-12-31
编辑:Matt J
2018-1-1
One way would be to use fzero. If the parametric equations for your line are L(t)=L0+t*D, the t that gives the intersection could be obtained as,
t_intersection = fzero(@(t) objective(t,L0,D,fitobj), t0)
function difference=objective(t,L0,D,fitobj)
L=L0+t*D;
x=L(1); y=L(2); z=L(3);
difference = z-fitobj(x,y);
end
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interpolation 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!