Interpolation from coarse to fine grid
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello. I am trying to do the following. I need to evaluate two functions on the vertices of a uniform 5 x 5 grid and store them. Next , I need to decompose that grid into 2 overlapping sub-grids containing 24 points each. The first containing 24 points (1-24) where the first point is on the lower left hand corner. The second containing 24 points (18-36). How do I do in MATLAB?
0 Commenti
Risposte (1)
ANKUR KUMAR
il 20 Set 2018
Hope this helps. The below code convert data over finer grids as well as it does vertical interpolation too.
lat=[65:1:75];
lon=[0:1:15];
data_lev1=randi(32,16,11);
lat_req=[65:0.5:75];
lon_req=[0:0.5:15];
%for interpolating over on finer grids
[lat_req_mesh,lon_req_mesh]=meshgrid(lat_req,lon_req);
for kk=1:size(lat_req_mesh,2)
data_lev1_finer(:,kk)=interp2(lat,lon,data_lev1,lat_req_mesh(:,kk),lon_req_mesh(:,kk));
end
data_lev2_finer=randi(32,31,21);
data_lev12=cat(3,data_lev1_finer,data_lev2_finer);
size(data_lev12)
%for interpolating over vertical levels. data_lev12 contains lat, lon and 2
%levels. If you wish to interpolate over 5 levels, then use following code
[lat_req_mesh,lon_req_mesh,vert_levs]=meshgrid(lat_req,lon_req,1:15);
data_lev12_vert=interp3(lat_req,lon_req,[1,24],data_lev12,lat_req_mesh,lon_req_mesh,vert_levs);
size(data_lev12_vert)
Vedere anche
Categorie
Scopri di più su Interpolation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!