[英]Evaluate a 3D spline in Matlab
I'm struggling to find a solution to this problem since the last week and still got no result. 自上周以来,我一直在努力寻找解决此问题的方法,但仍然没有结果。
I have a 3d spline in matlab, necessarily defined (I can't change the representation) with the spap2 command, and I need to evaluate the spline itself given two coordinates (say x and y). 我在matlab中有一个3d样条,必须使用spap2命令定义(我不能更改表示形式),并且需要给定两个坐标(例如x和y)来评估样条本身。 I tried to use the fnval command with different sintaxes but with no success.
我试图将fnval命令与其他正弦值一起使用,但没有成功。
Example: I'd like to get the z at x=26, y=120 with the spline defined with 示例:我想使用在样条上定义的样条曲线获得x = 26,y = 120的z
x=[13 56 90 67 89 43];
y=[112 156 136 144 144 128];
z=[63 95 48 78 77 15];
sp = spap2(4,4,1:length(x),[x; y; z]);
Could anyone help me? 有人可以帮我吗? Thank you very much!
非常感谢你!
A spline is an approximation. 样条曲线是一个近似值。 It does not need to go through the coordinates (x=26,y=120) at all.
它根本不需要通过坐标(x = 26,y = 120)。 There is no immediate definition of what z value would be reasonable for these (x, y) values.
对于这些(x,y)值,没有z值合理的即时定义。
Your x values (independent values) are 1:length(x)
and the output (dependent values) is [x;y;z]
. 您的x值(独立值)为
1:length(x)
,输出(独立值)为[x;y;z]
。
For example fnval(sp, 1.5)
gives a reasonable output. 例如
fnval(sp, 1.5)
给出合理的输出。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.