Interpolating over a grid
Afficher commentaires plus anciens
Hello. I have a grid of x and y coordinates and I would like to interpolate some z values over this grid. The grid constitues an area of ocean, and the z values, d_sea, constitutes sea depth values in metres. The dataset seadepth_002536 is a line of known seadepth values. I would like to know the sea depth values of the entire [x,y] grid. I have tried using interp2 but I am getting errors. Any help is appreciated. Thanks.
tykkelse_002536 = load('tykkelse_002536.txt');
seadepth_002536 = load('seafloor_depth_002536.txt');
v_sea = 1500; %p-wave velocity of water
v_sed = 2000; %p-wave velocity of sediment
x = tykkelse_002536(:,1);
y = tykkelse_002536(:,2);
d = tykkelse_002536(:,3);
d = d .* v_sed;
x_sea = seadepth_002536(:,1);
y_sea = seadepth_002536(:,2);
d_sea = seadepth_002536(:,3);
[Uxz_sea,ia,ic] = unique([x_sea d_sea],'rows');
x_sea = Uxz_sea(:,1);
d_sea = Uxz_sea(:,2);
d_sea = d_sea .* v_sea;
dx = 20;
x_ax=min(x):dx:max(x);
y_ax=min(y):dx:max(y);
[xx,yy]=meshgrid(x_ax,y_ax);
zii = interp2(x_sea,y_sea,d_sea,xx,yy);
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Interpolation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!