Issues with "interp2" in MatLab, 2-d data interpolation

I am trying to use "interp2" to fill in values of a dataset (chlorophyll data) with missing (Nan) points. I have four datasets I am working with: land points (1x3744), chlorophyll data (144x3744), latitude (1x3744), and longitude (1x3744). For the chlorophyll data, the rows are time and the columns are space. I have tried to reshape all the data into matrices but I keep getting errors and can't figure out how to appropriately prepare these to use "interp2" successfully.

5 个评论

Shows us the code! Preferrable with synthetic data so we can run it.
what code would you like to see? my attempts to use inter2 with the errors?
And copy/pastes of the exact error messages.
>> land2=reshape(land,72,52);
>> lon2=reshape(lon,72,52);
>> lat2=reshape(lat,72,52);
>> a=reshape(xnew(1,:),72,52);
>> lon2(land)=nan;
>> lat2(land)=nan;
>> lon2=reshape(lon,72,52);
>> lat2=reshape(lat,72,52);
>> a(land)=nan;
>> ZI = interp2(lon2,lat2,a,lon2,lat2);
??? Error using ==> interp2 at 155 X and Y must be matrices produced by MESHGRID. Use GRIDDATA instead of INTERP2 for scattered data.
>> ZI = griddata(lon2,lat2,a,lon2,lat2);
??? Error using ==> qhullmx The first input argument must be a double array.
Error in ==> delaunayn at 117 t = qhullmx(x', 'd ', opt);
Error in ==> griddata>linear at 150 tri = delaunayn([x y]);
Error in ==> griddata at 119 zi = linear(x,y,z,xi,yi,opt);
>> ZI = griddata(double(lon2),double(lat2),double(a),double(lon2),double(lat2));

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Interpolation 的更多信息

提问:

2013-2-19

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by