Matlab 3D data interpolation

冷暖自知 提交于 2019-12-11 23:20:03

问题


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.

Any help much appreciated ,

Tom.


回答1:


you have the matlab function interp2

then your code will be zi = interp2(x,y,z,xi,yi);

you can generate evenly spaced xi and yi using mesh grid

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 will look like [1 2 3; 1 2 3]

and yi, [4 4 4; 5 5 5]

hope it helps!



来源:https://stackoverflow.com/questions/25647050/matlab-3d-data-interpolation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!