|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
load 200
fs=12000;
N=2048*4;
t=(0:1/fs:(N-1)/fs);
x=X200_DE_time ;
data=x(1:N,1)';
%jiang zao
[thr,sorh,keepapp]=ddencmp('den','wv',data); %去噪
data1=wdencmp('gbl',data,'sym1',2, thr,sorh,keepapp);
wpt=wpdec(data1,3,'db5'); %三层小波包分解
%节点 31
c31=wpcoef(wpt,[3,1]); %重构节点31
c31=abs(c31);
m31=mean(c31); %求均值
a31=var(c31);%求方差
thr31=m31+a31%求阈值
for i=1:1024;
if c31(i)<thr31;
c31(i)=0;
end
end
e31=0;
for i=1:1024;
e31=e31+(c31(i))^2;%节点31能量
end
%节点32
c32=wpcoef(wpt,[3,2]);
c32=abs(c32);
m32=mean(c32);
a32=var(c32);
thr32=m32+a32
for i=1:1024;
if c32(i)<thr32;
c32(i)=0;
end
end
e32=0;
for i=1:1024;
e32=e32+(c32(i))^2;
end
%节点 33
c33=wpcoef(wpt,[3,3]);
c33=abs(c33);
m33=mean(c33);
a33=var(c33);
thr33=m33+a33
for i=1:1024;
if c33(i)<thr33;
c33(i)=0;
end
end
e33=0;
for i=1:1024;
e33=e33+(c33(i))^2;
end
%jiedian 34
c34=wpcoef(wpt,[3,4]);
c34=abs(c34);
m34=mean(c34);
a34=var(c34);
thr34=m34+a34
for i=1:1024;
if c34(i)<thr34;
c34(i)=0;
end
end
e34=0;
for i=1:1024;
e31=e34+(c34(i))^2;
end
%jiedian 35
c35=wpcoef(wpt,[3,5]);
c35=abs(c35);
m35=mean(c35);
a35=var(c35);
thr35=m35+a35
for i=1:1024;
if c35(i)<thr35;
c35(i)=0;
end
end
e35=0;
for i=1:1024;
e35=e35+(c35(i))^2;
end
%jiedian 36
c36=wpcoef(wpt,[3,6]);
c36=abs(c36);
m36=mean(c36);
a36=var(c36);
thr36=m36+a36
for i=1:1024;
if c36(i)<thr36;
c36(i)=0;
end
end
e36=0;
for i=1:1024;
e36=e36+(c36(i))^2;
end
%jiedian 37
c37=wpcoef(wpt,[3,7]);
c37=abs(c37);
m37=mean(c37);
a37=var(c37);
thr37=m37+a37
for i=1:1024;
if c37(i)<thr37;
c37(i)=0;
end
end
e37=0;
for i=1:1024;
e37=e37+(c37(i))^2;
end
disp(e31);disp(e32);disp(e33);disp(e34);disp(e35);disp(e36);disp(e37);
比较能量大小,选取能量大的频带进行fft
c36=wprcoef(wpt,[3,6]);
c36=abs(c36);
p=c36.^2;
nfft=1024*8;fs=12000;
ff=abs(fft(p));
f=fs*(0:nfft/2-1)/nfft;figure(2);
plot(f,ff(1:nfft/2))
axis([0,800,0,60])
故障频谱图如下
请同仁看看 我哪里不对啊
|
|