From: nattsat nctu on
Dear all,

I have tried to interpolate the 2D data but just realized that it is not a uniform grid, my data looks like:

latitude longitude data
---------------------------------------
38.82605 73.05077 74
38.89838 73.30076 56
38.96964 73.55139 54
39.03984 73.80267 59
39.06496 72.97436 91
39.13754 73.22533 86
39.20905 73.47697 82
39.27948 73.72927 79
39.30354 72.89727 124
39.37637 73.14924 113

and I need to interpolate them to, latitude=39 and longitude = 73.5. I have tried to use interp2 and griddata but MATLAB require a uniform grid, so any one is familiar with this problem please help

Thanks in advance :-)
nattsat
From: Bruno Luong on
"nattsat nctu" <nattsat(a)yahoo.com> wrote in message <hjbhfl$t6t$1(a)fred.mathworks.com>...
>
> griddata but MATLAB require a uniform grid, so any one is familiar with this problem please help

GRIDDATA does not require that. Take a closer look again.

Bruno
From: Alvaro Canivell on
Bruno is abs. right, you just need to do:

% define a grid for latitude (x) and longitude(y)
[newLatitudeGrid, newLongitudeGrid] = meshgrid([38:0.1:40],[72:0.1:74])

% evaluate data(z) on the new grid
newDataGrid = griddata(latitude, longitude, data, newLatitudeGrid, newLongitudeGrid);

It should be smthing like this