matlab三维地形图

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
%%%%—————Code to draw 3D bathymetry——————————
%-------Created by bobo,10/10/2021--------------------
clear;clc;close all;
ncdisp 'E:\data\etopo\scs_etopo.nc'
filenm='E:\data\etopo\scs_etopo.nc';
lon=double(ncread(filenm,'lon'));
lat=double(ncread(filenm,'lat'));
depth=double(ncread(filenm,'elevation'));
%
aim_area=[105 125;0 25];
%
indian_lon=lon(lon>=aim_area(1,1)&lon<=aim_area(1,2));
indian_lat=lat(lat>=aim_area(2,1)&lat<=aim_area(2,2));
[xx,yy]=meshgrid(indian_lon,indian_lat);
xx=xx';
yy=yy';
%
indian_depth=depth(lon>=aim_area(1,1)&lon<=aim_area(1,2),lat>=aim_area(2,1)&lat<=aim_area(2,2));
%% ---------------------------------------------
for i = 2:65
    close all;
    figure
    view([10 -10 55])
    hold on
    surf(xx,yy,indian_depth);
    shading interp
    axis([aim_area(1,1) aim_area(1,2) aim_area(2,1) aim_area(2,2) -7000 900])
    xlabel('Longitude','FontSize',12);
    ylabel('Latitude','FontSize',12);
    zlabel('Elevation(m)','FontSize',12);
    h=colorbar('v');
    % read my colormore
    map1= load(['D:\matlab_work\函数名为colormore的颜色索引表制作\colormore_txt\colormore_',num2str(i),'.txt']);
    colormap(map1)
    clim([-7000 900]);
    set(get(h,'ylabel'),'string','Elevation(m)','fontsize',12);
    text(118,22,1000,'Taiwan Island','color','k','fontsize',12,'fontweight','bold');
    text(118,19,0,'Luzon Strait','color','k','fontsize',12,'fontweight','bold');
    text(118,16,100,'Luzon Island','color','k','fontsize',12,'fontweight','bold');
    title('Bathymetry of Luzon Strait','FontSize',12,'fontweight','bold');
    export_fig(['matlab地形图',num2str(i),'.png'],'-r300');
end



















