《希尔伯特变换程序》由会员分享,可在线阅读,更多相关《希尔伯特变换程序(2页珍藏版)》请在金锄头文库上搜索。
1、B=load(D:测试用 DAT2kwaiquan.dat); data=1:100; for j=1:100;data(j)=0; end for n=1:8:100 A=B(n*1024+1:(n+8)*1024); A=A/(230); A=A-mean(A); fs=2000; fa=fs/2; t=0:8191; tt=1/2000*t; ti=fs/8196*t; c,l=wavedec(A,4,db8); a4=wrcoef(a,c,l,db8,4); d4=wrcoef(d,c,l,db8,4); d3=wrcoef(d,c,l,db8,3); d2=wrcoef(d,c,l,
2、db8,2); d1=wrcoef(d,c,l,db8,1); figure(1) subplot(3,2,1),plot(tt,a4); ylabel(a4); axis tight; subplot(3,2,2),plot(tt,d4); ylabel(d4); axis tight; subplot(3,2,3),plot(tt,d3); ylabel(d3); axis tight; subplot(3,2,4),plot(tt,d2); ylabel(d2); axis tight; subplot(3,2,5),plot(tt,d1); ylabel(d1); axis tight
3、;fx=abs(fft(A(1:2048); fx=fx.*fx; nie1=(fx(159)+fx(160)+fx(161)/3; nie2=(fx(319)+fx(320)+fx(321)/3; if(nie1=nie2)dd=d2;maxf=312.5;elsedd=d3;maxf=156.25; end dd=d1; % maxf=312.5; % wn=(maxf-50)/fa,(maxf+50)/fa; % b=fir1(32,wn); % dd=filter(b,1,A); hx1=abs(hilbert(dd(1:1024); hx2=abs(hilbert(dd(1*1024
4、+1:2*1024); hx3=abs(hilbert(dd(2*1024+1:3*1024); hx4=abs(hilbert(dd(3*1024+1:4*1024); hx5=abs(hilbert(dd(4*1024+1:5*1024); hx6=abs(hilbert(dd(5*1024+1:6*1024); hx7=abs(hilbert(dd(6*1024+1:7*1024); hx8=abs(hilbert(dd(7*1024+1:8*1024); hx=hx1 hx2 hx3 hx4 hx5 hx6 hx7 hx8; bx=hx-mean(hx); hx=abs(fft(bx)
5、; hx=hx.*hx; cx=abs(hilbert(dd); cx=cx-mean(cx); cx=abs(fft(cx); cx=cx.*cx; figure(2) subplot(2,2,1),plot(tt,bx); axis tight; d=0:2047; td=fs/2048*d subplot(2,2,2),plot(td(1:1024),fx(1:1024); axis tight; subplot(2,2,3),plot(ti(1:400),hx(1:400); axis tight; subplot(2,2,4),plot(ti(1:400),cx(1:400); axis tight; end