如何在MATLAB绘制Hovmoller图吗?- 江南体育网页版- - - - -地球科学堆江南电子竞技平台栈交换 最近30从www.hoelymoley.com 2023 - 07 - 10 - t21:20:11z //www.hoelymoley.com/feeds/question/8251 https://creativecommons.org/licenses/by-sa/4.0/rdf //www.hoelymoley.com/q/8251 4 如何在MATLAB绘制Hovmoller图吗? NBE //www.hoelymoley.com/users/6199 2016 - 06 - 23 - t20:10:15z 2017 - 06 - 04 - t11:47:31z < p >我试图创建一个Hovmoller图在MATLAB但是我很新的编程和不知道该做什么。我想做涡度。以下是我目前的代码。任何输入或建议,将不胜感激。< / p > < pre > <代码>路径(路径“/用户/ zoleak /文件/”);lev_name = ' 700 '; % mb disp (strcat (lev_name“计算意味着字段…”,“m”)) file1 = ' /用户/ zoleak /文档/数据/帕特丽夏/ ERAi.T.00.2015.1p5.45N45S.nc ';file2 = ' /用户/ zoleak /文档/数据/帕特丽夏/ ERAi.U.00.2015.1p5.45N45S.nc ';file3 = ' /用户/ zoleak /文档/数据/帕特丽夏/ ERAi.V.00.2015.1p5.45N45S.nc ';file4 = ' /用户/ zoleak /文档/数据/帕特丽夏/ ERAi.GEO.00.2015.1p5.45N45S.nc ';file5 = ' /用户/ zoleak /文档/数据/帕特丽夏/ ERAi.VORT.00.2015.1p5.45N45S.nc '; file6 = '/Users/zoleak/Documents/Datasets/Patricia/ERAi.PV.00.2015.1p5.45N45S.nc'; %Read files in lat=ncread(file1,'latitude'); lon=ncread(file1,'longitude'); levels=ncread(file1,'level'); u_data=ncread(file2,'u'); v_data=ncread(file3,'v'); vort_data=ncread(file5,'vo'); %Format Files x=lon(28:121); y=lat(1:31); [nlons,nlats,ntimes]=size(vort_data); u_data=u_data(28:121,1:31,4,:); v_data=v_data(28:121,1:31,4,:); vort_data=vort_data(28:121,1:31,4,:); u_data=squeeze(squeeze(u_data)); v_data=squeeze(squeeze(v_data)); vort_data=squeeze(squeeze(vort_data)); %% clf; lat_avg=mean(vort_data(5:15,:,:),1); LONLIMS=[-139.5 -60]; LATLIMS=[0 30]; [lon_plot,lat_plot]=meshgrid(x,y); proj('mercator','lon',LONLIMS,'lat',LATLIMS); %m_quiver(lon_plot,lat_plot,u_data(:,:)',v_data(:,:)','LineStyle','-','Color',[0 0 0],'AutoScaleFactor',2); hold on; contourf(lon_plot,lat_plot,lat_avg(:,:)','LevelList',[-6e-4:1e-5:6e-4],'LineColor','none') coast('patch',[1 1 1],'linewi',2); grid('linewi',0.5,'tickdir','out','linest','none'); set(gca,'FontSize',14); set(gcf,'Color','white'); hcb=colorbar('eastoutside'); title(['5N-20N,700mb Vorticity']); set(hcb,'YTick',[-1e-4:1e-5:1e-4]) caxis([-.5e-4 .5e-4]) save_name1=strcat('/Users/zoleak/Documents/figures/HOVMOLLER/PAT_VORT'); print(save_name1,'dpdf'-r600); //www.hoelymoley.com/questions/8251/-/8736 # 8736 0 答案由jgadoury如何在MATLAB绘制Hovmoller图吗? jgadoury //www.hoelymoley.com/users/6444 2016 - 09 - 13 - t19:14:01z 2016 - 09 - 13 - t19:14:01z < p >我没有在MATLAB编程在相当长一段时间,但我记得做一些Hovmoller图在我的研究生学习。我只是看着我的旧代码,我使用了函数<代码> contourf > < /代码,我输入我的是一个二维矩阵数据(row-wise半径,列时间)。< / p > //www.hoelymoley.com/questions/8251/-/8738 # 8738 2 答案由arkaia如何在MATLAB绘制Hovmoller图吗? arkaia //www.hoelymoley.com/users/111 2016 - 09 - 14 - t01:06:08z 2016 - 09 - 14 - t01:43:01z < p >这是一个例子使用< a href = " http://www.mathworks.com/help/matlab/ref/contourf.html " rel =“nofollow”> contourf < / >。诀窍是在适当取样3 d数组:< / p > < pre > <代码> x = linspace(0,π,20);y = linspace(0,π,10);t = 0:10:120;[X3d, Y3d T3d] = meshgrid (x, y, t);[X2d, T2dx] = meshgrid (x, t);[Y2d, T2dy] = meshgrid (y, t);dat3d = 7 * sin (X3d) + 5 * cos (Y3d) + T3d / max (T3d(:)) +兰德(大小(X3d));dat2dx = 7 * sin (X2d) + 5 * cos (y (5)) + T2dx / max (T2dx(:)) +兰德(大小(X2d));%在y (5) dat2dy = 7 * sin (x (12)) + 5 * cos (Y2d) + T2dy / max (T2dy(:)) +兰德(大小(Y2d)); % at x(12) %% figure(1);clf contourf(X2d,T2dx,dat2dx); shading flat; colorbar ylabel('Time (days)') xlabel('X distance (km)') %% figure(2);clf contourf(Y2d,T2dy,dat2dy); shading flat; colorbar ylabel('Time (days)') xlabel('Y distance (km)') %% figure(3);clf subplot(221) contourf(squeeze(X3d(5,:,:)),squeeze(T3d(5,:,:)),squeeze(dat3d(5,:,:))); shading flat; colorbar ylabel('Time (days)'); xlabel('X distance (km)') title('Hovmoller at y(5)') subplot(222) contourf(squeeze(Y3d(:,12,:)),squeeze(T3d(:,12,:)),squeeze(dat3d(:,12,:))); shading flat; colorbar ylabel('Time (days)'); xlabel('Y distance (km)') title('Hovmoller at x(12)') subplot(223) contourf(squeeze(X3d(8,:,:)),squeeze(T3d(8,:,:)),squeeze(dat3d(8,:,:))); shading flat; colorbar ylabel('Time (days)'); xlabel('X distance (km)') title('Hovmoller at y(8)') subplot(224) contourf(squeeze(Y3d(:,17,:)),squeeze(T3d(:,17,:)),squeeze(dat3d(:,17,:))); shading flat; colorbar ylabel('Time (days)'); xlabel('Y distance (km)') title('Hovmoller at x(17)')
Baidu
map