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