www.pudn.com > harmonic_wavelet.rar > harwav_freq.m, change:2008-07-03,size:932b
%%%%%谐波小波变换的频域实现方法%%%%%%%%%% clear fs=4000; dett=1/fs;%采样周期 nx=400;%采样点数 tp=nx*dett;%采样时间长度 t=0:dett:(nx-1)*dett;%时间向量 detf=1/tp;%频率间隔 f=0:detf:(nx-1)*detf;%频率向量 %%信号部分 x=sin(100*pi*t); x(90:170)=0.98*x(90:170); subplot(411);plot(t,x); fft_x=fft(x); %fft_x=fft_x(1:nx/2); subplot(412);stem(f,abs(fft_x)); fmin=500; fmax=1000; p=floor(fmin/detf);%由于软件数据标识的关系,不进行减1操作,最好直接达到整数 q=floor(fmax/detf); %%%构造谐波小波频域序列采样点%%% c1=zeros(1,p); c2=ones(1,q-p); c3=zeros(1,nx-q); c=[c1,c2,c3]; har_mol=1/((fmax-fmin)*2*pi);%谐波小波频域幅值 har_fre=har_mol*c;%谐波小波频率特性 %subplot(413);stem(f,har_fre); aw=fft_x.*har_fre;%频域小波系数 a=ifft(aw); signal=abs(a);%*4*pi*(fmax-fmin); subplot(413);plot(t,signal);% %t1=0:4*dett:(nx-1)*dett; %subplot(413);stem(t1,abs(a{km})); [ca,cd]=dwt(x,'db3'); subplot(414);plot(abs(cd));