% esempio_griddata.m clear; clc; %close all %% load seamount figure(1); clf plot3(x,y,z,'.','markersize',10) grid on; box on xlabel('Longitude') ylabel('Latitude') zlabel('Depth in Feet') %% MENU=menu('Interpolation method?','linear C0 (default)','nearest discontinuous','natural C1','cubic C2'); switch MENU case 1, method='linear'; case 2, method='nearest'; case 3, method='natural'; case 4, method='cubic'; end [xi,yi] = meshgrid(210.8:0.01:211.8, -48.5:0.01:-47.9); zi = griddata(x,y,z,xi,yi,method); %% figure(2); clf [c,h] = contour(xi,yi,zi); clabel(c,h); xlabel('Longitude') ylabel('Latitude') title('Contour plot','FontWeight','normal','FontSize',16) %% figure(10+MENU); clf h=surf(xi,yi,zi); %set(h,'EdgeColor','none') hold on; grid on; box on plot3(x,y,z,'.r','markersize',8) xlabel('Longitude') ylabel('Latitude') zlabel('Depth in Feet') title(['Interpolation method: ''' method ''''],'FontWeight','normal','FontSize',16)