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

7 次查看(过去 30 天)
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 个评论
Maureen
Maureen 2013-2-21
>> 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 个)

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by