马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
%xiaobobao xiaozao
fs=12000;N=1024;
fd=fopen('C:\张\120.mat','rb');
xdata=(fread(fd,N+25,'float64'));
fclose(fd);
xdata=xdata(26:N+25);
xdata=xdata-mean(xdata);
%小波包分解
layer=2;wpname='db1';
T=wpdec(xdata,layer,wpname);
%小波包重构
rfs0=wprcoef(T,[0 0]);
rfs1=wprcoef(T,[1 0]);
rfs2=wprcoef(T,[1 1]);
figure(1)
subplot(411);plot(xdata,'linewidth',2);
title('yuanshixinhao','fontsize',12);axis([0 1024 -1 1]);
subplot(412);plot(rfs0,'linewidth',2);title('Reconstructed Packet(0,0)');axis([0 1024 -1 1]);
subplot(413);plot(rfs1,'linewidth',2);title('Reconstructed Packet(1,0)');axis([0 1024 -1 1]);
subplot(414);plot(rfs2,'linewidth',2);title('Reconstructed Packet(1,1)');axis([0 1024 -0.5 0.5]);
xlabel('caiyangdianshu');
%packet(1,1)信号的络图
y=hilbert(rfs2);
ydata=abs(y);ydata=ydata-mean(ydata);
nfft=1024;p=abs(fft(ydata,nfft));
[pmax,i]=max(p);
fmax=4/1024*12000;
figure(2)
subplot(111);
plot((1:nfft/2-1)nfft*fs,p(2:nfft/2),'linewidth',2);
title('packet(1,1)的包络图','fontsize',12);
grid on
text(fmax,pmax,int2str(fmax));
set(gca,'xlim',[0,nfft]);
set(gca,'xtick',[0:nfft/16:nfft]);
xlable('频率f/HZ','fonsize',12);ylabe('功率谱幅值/微米','fontsize',12);
set(gca,'linewidth',2);
grid off
图形显示 |