Matlab 3D数据插值 [英] Matlab 3D data interpolation
问题描述
我有一组x,y和z数据(每个都是3000 x 1矩阵),我想对该数据进行插值,以在x和y值均等的位置具有一组z高度值.我假设我需要对x和y数据集进行网格划分,但是我不知道如何为z数据进行插值.数据点是从STL文件中提取的唯一顶点,因此我希望对生成的表面进行平滑处理.
I have a set of x,y and z data (each is a 3000 by 1 matrix) and I would like to interpolate this data to have a set of values for the z height at evenly spaced x and y values. I assume I need to mesh grid the x and y data sets, but I don't know how to interpolate for the z data. The data points are the unique vertices taken from an STL file, and so I'm looking to smooth out the resulting surface.
任何帮助,
汤姆.
推荐答案
您有matlab函数interp2
you have the matlab function interp2
然后您的代码将为zi = interp2(x,y,z,xi,yi);
then your code will be zi = interp2(x,y,z,xi,yi);
您可以使用网格生成均匀分布的xi和yi
you can generate evenly spaced xi and yi using mesh grid
xi和yi将是x和y的值,您将在这些值处进行插值,它们是正方形.例如,如果您想插值xi = 1 2 3和yi = 4 5,那么
xi and yi will be the value of x and y at which you will make the interpolation, they are on a square form. E.g., if you want to interpolate at xi = 1 2 3 and yi = 4 5, then
xi看起来像 [1 2 3; 1 2 3]
xi will look like [1 2 3; 1 2 3]
和易, [4 4 4; 5 5 5]
and yi, [4 4 4; 5 5 5]
希望有帮助!
这篇关于Matlab 3D数据插值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!