使用matlab的3d线插值

问题描述 投票:0回答:1

我是matlab的初学者,我想沿z轴提取一些点值。

enter image description here

我有一个3d线信息,如上图所示。使用这个数据集,我想在z具有像105,104,103,102 ,,,,,,的整数值时提取x,y值。

我怎么解决这个问题?有人知道这个问题吗?谢谢!!

matlab interpolation
1个回答
1
投票

您可以使用1d插值函数interp1对x值和y值进行插值(使用您选择的方法),每个值由z值参数化,并根据您想要的z值进行评估。

例:

% generate some data
z = 1:200;
x = sin(z/20);
y = cos(z/30);
plot3(x,y,z,'o-')

% define the points where you want to evaluate your data
desiredZ = [102,103];

%interpolate each component
interpX = interp1(z,x,desiredZ);
interpY = interp1(z,y,desiredZ);
© www.soinside.com 2019 - 2024. All rights reserved.