How can I interpolate a pressure vector to the surface?

I am working with a pressure vector whose coordinates are between [10,1000] in hPa with 32 pressure values and it is defined between 20ºN-50ºN and 180ºW-180ºE with a resolution of 1º, but now I need to interpolate it to the surface for each latitude and longitude to have a value for the surface pressure in each grid point. How can I do it?
Thnak you so much

 채택된 답변

Youssef  Khmou
Youssef Khmou 2013년 7월 20일
hi,
You can use the function interp2 like in the demo ( type doc interp2) :
[X,Y] = meshgrid(-3:.25:3);
Z = peaks(X,Y);
[XI,YI] = meshgrid(-3:.125:3);
ZI = interp2(X,Y,Z,XI,YI);
mesh(X,Y,Z), hold, mesh(XI,YI,ZI+15)
hold off
axis([-3 3 -3 3 -5 20])

댓글 수: 2

But I have the problem that my arrays aren´t of the same size and the grid pressure points aren´t separate in the same way, I´m confuse.
ok can you post the dimensions of all your variables, we can reshape them ...

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Andrei Bobrov
Andrei Bobrov 2013년 7월 20일
편집: Andrei Bobrov 2013년 7월 22일
lon = randi([-180,180],32,1);
lat = randi([20,50],32,1);
P = randi([10,1000],32,1); % your data
F = scatteredInterpolant(lat,lon,P,'natural','linear');
[xq,yq] = ndgrid(20:50, -180:179);
pv = F(xq,yq);
figure
mesh(xq,yq,pv);
hold on
plot3(lat,lon,P,'o');
please read about function scatteredInterpolant.
ADD
Try use griddata:
lon = randi([-180,180],32,1);
lat = randi([20,50],32,1);
P = randi([10,1000],32,1); % your data
[xq,yq] = ndgrid(20:50, -180:179);
vq = griddata(lat,lon,P,xq,yq,'cubic');
figure
mesh(xq,yq,vq);
hold on
plot3(lat,lon,P,'o');

댓글 수: 5

Youssef  Khmou
Youssef Khmou 2013년 7월 20일
편집: Youssef Khmou 2013년 7월 20일
Andrei, which version contains the function scatteredInterpolant ?
R2013a (8.01)
Thanks so much for your answer, but I have version R2012a, how can I do the same but in this version?
Thanks
See ADD part in this answer.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by