- 积分
- 1059
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-4-16
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
>> clear;
load q.txt
sst =q;
n=length(q);
variance = std(sst).^2;
sst = (sst - mean(sst))./sqrt(variance);
dt = 1;
year = [0:n-1]+ 1644.0 ;
xlim = [1644,1911]; %
pad = 1;
dj = 1/12;
s0 = 1/2*dt;
j1 = 6.5/dj;
lag1 = 0.72;
mother = 'Morlet';
[wave,period,scale,coi] = wavelet(sst,dt,pad,dj,s0,j1,mother);
power = (abs(wave)).^2 ; %计算小波系数的模的平方
modulus=abs(wave); %计算小波系数的模
variance1=sum(power')./n;%计算小波方差
%画小波系数实部等值线图
fig1=figure;
%subplot(3,1,1)
levels = [0,0.5,1.0,1.5,2.0,2.5];
v = [0,0.5,1.0,1.5];
Yticks = 0:5:30;
[c,h]=contour(year,period,real(wave),levels,'k-');
clabel(c,h,v,'fontsize',5);
xlabel('年份/year')
ylabel('周期/年 period/year')
title('(a)')
set(gca,'XLim',xlim(:))
set(gca,'YLim',[0 30], ...
'YDir','default', ...
'YTick',Yticks(:), ...
'YTickLabel',Yticks)
hold on
levels = [-0.5,-1.0,-1.5,-2.0,-2.5];
v = [-0.5,-1.0,-1.5];
[c,h] = contour(year,period,real(wave),levels,'r--');
clabel(c,h,v,'fontsize',5);
hold on
% 画小波方差图
fig2=figure;
%subplot(3,1,2)
plot(period,variance1,'k-')
hold on;
levels= [1,5,10,15,20,25,30,35,40,45];
title('(b)')
set(gca,'XLim',[1,50], ...
'XTick',levels,...
'XTickLabel',levels)
xlabel('周期/a')
ylabel('方差 variance')
hold on
%画小波系数模
fig3=figure;
%subplot(3,1,3)
levels = [0,0.5,1.0,1.5,2.0,2.5];
v = [0,0.5,1.0,1.5];
Yticks = [0:5:30];
[c,h]=contour(year,period,abs(wave),levels,'k-');
clabel(c,h,v,'fontsize',5);
title('(c)')
xlabel('年份/year')
ylabel('周期/年 period/year')
set(gca,'XLim',xlim(:))
set(gca,'YLim',[0 30], ...
'YDir','default', ...
'YTick',Yticks(:), ...
'YTickLabel',Yticks)
??? Error using ==> minus
Matrix dimensions must agree.
老是出错,菜鸟也不知道怎么改。另附上我的数据(第一幅图),想做个周期分析还有像第二幅图那样的结果的。不知道我的这些数据能不能做出来。求大家帮帮忙
|
|