MATLAB: How to convert a uniform gridded matrix to non-uniform gridded one

surface plot with non-uniform griddinguniform to non uniform gridding

I have a uniformly gridded 200X1600 (y&X axis respectively) matrix (a ccd image data) of z values. I want to convert it to a nonuniform gridded matrix where the nonuniform gridding comes from the fact of calibrating the X-axis (from pixel to raman shift for ex.). Basically I want to create a 2D surface plot with X axis is now raman shift instead of pixel number. I have the pixel to raman shift calibration file. Shirshendu

Best Answer

For each point in your output image, it will lie in between 4 points in your input image. So you can just use bilinear interpolation. If it were uniform gridding, say just translated, then you could use interp1(), but since it's non-uniform, the pixels are located at oddball locations so you have to do it one pixel at a time (I think). It's sort of the opposite of the griddedInterpolant situation, which gives you a uniform grid based on randomly located input locations.