matlab绘图

2022-04-10  本文已影响0人  Aerosols

图片名称必须是cell型,并且不能有:

ph2 = 'E:\论文\探空\';
list = dir([ph2,'seasia_54511_sounding_2017_10_2*.txt']);
k = length(list);   %总文件数量%

for i=1:k-2
    filename = strcat(ph2,list(i).name);
    fid=fopen(filename,'r');
    if fid<0
        disp('打开文件失败!');
        return;
    else
        FormatString=repmat('%f ',1,11);
        out(:,:,i) =cell2mat(textscan(fid,FormatString,18,'HeaderLines',6)); %从7行开始读取18*11的矩阵数据,跳6行
    end
    disp('文件读取成功!');
    
    %     if fclose(fid)==0
    %         disp('文件关闭成功!');
    %     else
    %         disp('关闭文件失败!');
    %     end
    %     fclose(fid);
end

Varname={'PRES(hPa)','HGHT(m)','TEMP(c)','DWPT(c)','RELH(%)','MIXR(g/kg)','DRCT(deg)','SKNT(knot)','THTA(K)','THTE(K)','THTV(K)'};%knot/2=m/s
%%% 需要的列是2(高度),7(风向),8(风速),9(位温)


%%% 绘图
for i=1:10
figure;
number = 37+i*12;
plot(wind(number,1:26),z(number,1:26),'b-','linewidth',3);
hold on;
scatter(out(:,8,i)/2,out(:,2,i),50,'r','filled');
xlim([0,25])
ylim([0,3000])
set(gca,'ytick',[0 500  1000 1500 2000 2500 3000],'yticklabel',{'0','0.5','1','1.5','2','2.5','3'},'fontsize',14,'fontname','Times new roman')
set(gca,'xtick',[0 5  10 15 20 25],'xticklabel',{'0','5','10','15','20','25'},'fontsize',14,'fontname','Times new roman')
xlabel('m/s','fontsize',14,'fontname','Times new roman')
ylabel('Height(km AGL)','fontsize',14,'fontname','Times new roman')
title(date2(number))
set(gca,'fontsize',14,'fontname','Times new roman')
set(gca,'XMinorTick','on')
set(gca,'YMinorTick','on')
print('-r150','-dpng',['E:\论文\低空急流\图片\探空VS模式\',pigname{number}])
end

overlay 使用panel
http://www.ncl.ucar.edu/Applications/panel.shtml
http://www.ncl.ucar.edu/Applications/Scripts/panel_13.ncl

上一篇 下一篇

猜你喜欢

热点阅读