Using the Plot 2D Vertical Function

조회 수: 1 (최근 30일)
Jordan David
Jordan David 2023년 5월 11일
댓글: Dyuman Joshi 2023년 5월 11일
I'm in a class where I've been given a crash course on the aforementined code. I'm having trouble interpreting where I am suppose to edit in the code to create what should be a vertical cross section of data so that my 144x11 matrix is displayed as such.
The code is
function status=plot_2d_vert(ifig,x,y,var,cmin,cmax,units);
status=0;
cmap=linspecer(50);
% make a matrix of lon
[nlon,nlev]=size(y);
lon=zeros(nlon,nlev);
for k=1:nlev
lon(:,k)=x;
end
%------------------------------------------
% now plot
%------------------------------------------
h=figure(ifig);
clf(ifig);
% position the figure
set(h,'Units','pixels','Position',[700 450 620 350]);
% plot
pcolor(lon,y,squeeze(var(:,:)));
hold on;
shading interp;
caxis([cmin cmax]);
set(gca,'YDir','reverse');
set(gca,'YScale','log');
%------------------------------------------
% all aesthetics
%------------------------------------------
ylim([100 1020]);
set(gca,'Ytick',[100 250 400 550 700 850 1000]);
set(gca,'YtickLabel',[' 100';' 250';' 400';' 550';' 700';' 850';'1000'],'fontsize',14);
set(gca,'Fontsize',14);
ax=gca;
ax.TickLength=[0.025;0.025];
% colorbar
hh=colorbar('EastOutside');
axx=gca;
axx.TickLength=[0.025;0.025];
set(hh,'Position',[0.912,0.318,0.01,0.403]);
set(hh,'Fontsize',14);
set(get(hh,'Title'),'String',units,'Fontsize',14);
ylabel('Pressure, in hPa','Fontsize',16);
xlabel('Longitude, in deg','Fontsize',16);
colormap(cmap);
status=1;
  댓글 수: 3
Jordan David
Jordan David 2023년 5월 11일
This is the full code sans the "end" I missed on the copy and paste. The students were randomly given this and sent off to figure it out with little context. Somehow I'm suppose to take this code and two 2D matrices to output a vertical cross section of the two variables (water vapor with height).
Dyuman Joshi
Dyuman Joshi 2023년 5월 11일
What are the two 2D matrices?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Orange에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by