clc;
%1981-2016年逐月海平面气压,2.5*2.5全球数据
slp=ncread('e:/slp.mon.mean.nc','slp');
%降水数据
pr_wtr=ncread('e:/pr_wtr.mon.mean.nc','pr_wtr');
%设置变量
nlon=144;
nlat=73;
nt=820;
%设置处理后的海平面气压场矩阵
aslp=zeros(nlat,nlon,nt);
apr=zeros(nlat,nlon,nt);
%处理原始海平面气压场和降水场
for t=1:nt;
aslp(:,:,t)=slp(:,:,t)';
apr(:,:,t)=pr_wtr(:,:,t)';
end;
%设置相应的降水函数及海平面函数
%海平面函数空间范围0~60N,60~150E。即(12:36,24:60)
%降水函数空间范围15~55N,110~140E。即(14:30,44;56)
nlat1=25;
nlon1=37;
nlat2=17;
nlon2=13;
slp1=zeros(nlat1,nlon1,nt);
slp2=zeros(nlat2,nlon2,nt);
for t=1:nt;
for j=1:nlat1;
for k=1:nlon1;
slp1(j,k,t)=aslp(j+11,k+23,t);
end;
end;
end;
for t=1:nt;
for j=1:nlat2;
for k=1:nlon2;
slp2(j,k,t)=apr(j+13,k+43,t);
end;
end;
end;
slp1=reshape(slp1,nlat1*nlon1,nt);
slp2=reshape(slp2,nlat2*nlon2,nt);
%矩阵距平化
for t=1:nlat1*nlon1;
slp1(t,:)=slp1(t,:)-mean(slp1(t,:));
end;
for t=1:nlat2*nlon2;
slp2(t,:)=slp2(t,:)-mean(slp2(t,:));
end;
%矩阵标准化
for t=1:nlat1*nlon1;
slp1(t,:)=slp1(t,:)/std(slp1(t,:));
end;
for t=1:nlat2*nlon2;
slp2(t,:)=slp2(t,:)/std(slp2(t,:));
end;
s=slp1*(slp2')/nt;
[l,lame,r]=svd(s);
u=(l')*slp1;
v=(r')*slp2;
la=zeros(nlat2*nlon2);
for t=1:nlat2*nlon2;
la(t)=lame(t,t)^2;
end;
la=la/sum(la);
%plot(la(1:10));
%title('SVD前10对模态的相对方差贡献');
%空间格点分开
l=reshape(l,nlat1,nlon1,nlat1*nlon1);
r=reshape(r,nlat2,nlon2,nlat2*nlon2);
slp1=reshape(slp1,nlat1,nlon1,nt);
slp2=reshape(slp2,nlat2,nlon2,nt);
%contourf(flipud(l(:,:,3)),100,'linestyle','none');
%set(gca,'XTick',1:12:37);
%set(gca,'XTickLabel',{'60°E','90°E','120°E','150°E'});
%set(gca,'YTick',1:6:25);
%set(gca,'YTickLabel',{'0°','15°N','30°N','45°N','60°N'});
%title('SVD第三模态东亚海平面气压场');
%colormap(jet);
%colorbar;
%contourf(flipud(r(:,:,3)),100,'linestyle','none');
%set(gca,'XTick',1:4:13);
%set(gca,'XTickLabel',{'110°E','120°E','130°E','140°E'});
%set(gca,'YTick',1:4:17);
%set(gca,'YTickLabel',{'15°N','25°N','35°N','45°N','55°N'});
%title('SVD第三模态中国东部降水分布');
%colormap(jet);
%colorbar;
%plot(1:nt,u(3,:),'r',1:nt,v(3,:),'b');
%legend('东亚海平面气压场','中国东部降水');
%ylim([-18,25]);
%xlim([0,nt]);
%title('SVD第三模态时间序列');
tz=zeros(10);
for t=1:10;
tz(t)=min(min(corrcoef(u(t,:),v(t,:))));
end;
%plot(tz(1:10));
%title('SVD前10对模态的总体相关系数');
rslp1=zeros(nlat1,nlon1,3);
for t=1:3;
for j=1:nlat1;
for k=1:nlon1;
rslp1(j,k,t)=min(min(corrcoef(slp1(j,k,:),v(t,:))));
end;
end;
end;
%contourf(flipud(rslp1(:,:,3)),100,'linestyle','none');
%set(gca,'XTick',1:12:37);
%set(gca,'XTickLabel',{'60°E','90°E','120°E','150°'});
%set(gca,'YTick',1:6:25)
%set(gca,'YTickLabel',{'0°','15°N','30°N','45°N','60°N'});
%title('SVD第三模态异性相关系数场a');
%colormap(jet);
%colorbar;
rslp2=zeros(nlat2,nlon2,3);
for t=1:3;
for j=1:nlat2;
for k=1:nlon2;
rslp2(j,k,t)=min(min(corrcoef(slp2(j,k,:),u(t,:))));
end;
end;
end;
%contourf(flipud(rslp2(:,:,3)),100,'linestyle','none');
%set(gca,'XTick',1:4:13);
%set(gca,'XTickLabel',{'110°E','120°E','130°E','140°E'});
%set(gca,'YTick',1:4:17);
%set(gca,'YTickLabel',{'15°N','25°N','35°N','45°N','55°N'});
%title('SVD第三模态异性相关系数b');
%colormap(jet);
%colorbar;
rrslp1=zeros(nlat1,nlon1,3);
for t=1:3;
for j=1:nlat1;
for k=1:nlon1;
rrslp1(j,k,t)=min(min(corrcoef(slp1(j,k,:),u(t,:))));
end;
end;
end;
%contourf(flipud(rrslp1(:,:,3)),100,'linestyle','none');
%set(gca,'XTick',1:12:37);
%set(gca,'XTickLabel',{'60°E','90°E','120°E','150°E'});
%set(gca,'YTick',1:6:25);
%set(gca,'YTickLabel',{'0°','15°N','30°N','45°N','60°N'});
%title('SVD第三模态同性相关系数a');
%colormap(jet);
%colorbar;
rrslp2=zeros(nlat2,nlon2,3);
for t=1:3;
for j=1:nlat2;
for k=1:nlon2;
rrslp2(j,k,t)=min(min(corrcoef(slp2(j,k,:),v(t,:))));
end;
end;
end;
contourf(flipud(rrslp2(:,:,3)),100,'linestyle','none');
set(gca,'XTick',1:4:13);
set(gca,'XTickLabel',{'110°E','120°E','130°E','140°E'});
set(gca,'YTick',1:4:17);
set(gca,'YTickLabel',{'15°N','25°N','35°N','45°N','55°N'});
title('SVD第三模态同性相关系数b');
colormap(jet);
colorbar;
评论7