%变量
para_all=[input_train_2017,input_train_2018,input_train_2019...
;output_train_2017,output_train_2018,output_train_2019 ];
%求相关系数矩阵
corr1=corrcoef(para_all');
%相关系数矩阵是对称的,令下三角矩阵保持不变,上三角置为0
corr2=tril(corr1)
%令上三角置为NaN
corr2(corr2==0)=NaN;
img=imagesc(corr3);
%NaN默认显示为数值最小的颜色,这里让它显示为白色
set(img,'alphadata',~isnan(corr3));
colormap(jet)
c=colorbar;
caxis([-1,1])
set(c,'YTick',(-1:0.4:1));
xlabel('Variables');
ylabel('Variables');
%x轴刻度标签
set(gca,'XTick',(1:9),'xticklabel',[string('Year'),string('Doy'),string('Hour'),...
string('P'),string('T'),string('RH'),string('ZTD'),string('HTG'),string('Rain')],'FontSize',10);
%Y轴刻度标签
set(gca,'YTick',(1:9),'yticklabel',[string('Year'),string('Doy'),string('Hour'),...
string('P'),string('T'),string('RH'),string('ZTD'),string('HTG'),string('Rain')],'FontSize',10);
%图片大小
set(gcf,'unit','centimeters','position',[6,4,12,9])
%保存为分辨率300的tiff图片
sfname='corr';
print(gcf,sfname,'-r300','-dtiff');