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

7 vues (au cours des 30 derniers jours)
Maureen
Maureen le 19 Fév 2013
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 commentaires
Matt J
Matt J le 20 Fév 2013
And copy/pastes of the exact error messages.
Maureen
Maureen le 21 Fév 2013
>> 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));

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by