N=2048;
y3=filter(hn,1,x);
figure(1);
subplot(2,1,1);
plot(y3);
axis([0 2048,-2000 2000]);
title('带通滤波后时域波形');
xlabel('时间t');
ylabel('幅值');
subplot(2,1,2);
Y=abs(fft(y3));
f=20000*(0:1024)/2048;
plot(f,Y(1:1025));
title('滤波后信号频谱');
xlabel('频率w');
ylabel('幅值');
buffer=y3;
buflen=N;
levels=4;
[resultdata,rtv]=multiintdwt(buffer,buflen,levels);
%d2=resultdata(513:1024);
%d3=resultdata(257:512);
%d4=resultdata(129:256);
%a4=resultdata(1:128);
%figure(2);
%subplot(5,1,1);
%plot(d4,'LineWidth',2);
%ylabel('d4');
%subplot(5,1,2);
%plot(d3,'LineWidth',2);
%ylabel('d3');
%subplot(5,1,3);
%plot(d2,'LineWidth',2);
%ylabel('d2');
%subplot(5,1,4);
%plot(d1,'LineWidth',2);
%ylabel('d1');
%subplot(5,1,5);
%plot(a4,'LineWidth',2);
%ylabel('a4');
%压缩过程
u=0;
u=u+1;
index=1;
data=resultdata;
value=zeros(1,N);
pos=zeros(1,N);
threshold=zeros(1,levels);
rate=0.62;
for i=1:levels
threshold(i)=0;
end
for i=1:levels
for j=N/power(2,levels+1-i):N/power(2,levels-i)
if threshold(i)<abs(data(j));
threshold(i)=abs(data(j));
end
end
threshold(i)=(1-rate)*threshold(i);
for j=N/power(2,levels+1-i)+1:N/power(2,levels-i) %j+1很重要
if abs(data(j))>threshold(i)
value(index+N/power(2,levels))=data(j);
pos(index+N/power(2,levels))=j;
index=index+1;
end
end
end
for i=1:N/power(2,levels)
value(i)=data(i);
pos(i)=i;
end
%解压缩过程
for i=1:N
data(i)=0;
end
for i=1:N
if pos(i)>0
data(pos(i))=value(i);
end
end
%重构过程
buffer=data;
buflen=N;
levels=4;
recondata=multiidint35(buffer,buflen,levels);
y1=recondata;
PRD=zeros(1,101);
CR=zeros(1,101);
index2=0;
e=y1'-y3;
PRD=100*sqrt(sum(power(e,2))/sum(power(y3,2)));
for i=1:N
if pos(i)>0
index2=index2+1;
end
end
if index2==2048
CR=index2*2/4096;
elseif (index2-128)>256
CR=4096/((index2-128)*2+index2*2);
else
CR=4096/((index2-128)+index2*2);
end
figure(3);
subplot(2,1,1);
plot(y1);
axis([0 2048,-2000 2000]);
title('带通滤波后时域波形');
xlabel('时间t');
ylabel('幅值');
subplot(2,1,2);
Y=abs(fft(y1));
f=20000*(0:1024)/2048;
plot(f,Y(1:1025));
xiaobolvbo.rar_5 3 小波_5/3 小波_5/3小波_matlab_小波滤波 matlab
版权申诉
5星 · 超过95%的资源 151 浏览量
2022-07-15
03:26:52
上传
评论
收藏 4KB RAR 举报
钱亚锋
- 粉丝: 87
- 资源: 1万+
最新资源
- 47-47.渗透测试-配置Kali Linux
- 卷积神经网络(Convolutional Neural Network,CNN)是一种深度学习模型
- DHT11温湿度传感器是一款常用的数字温湿度传感器,它结合了温度和湿度的测量功能,能够准确感知环境中的温度和湿度,并输出相应的数
- 45-45.渗透测试-天境漏洞扫描工具安装使用
- 基于PC817光耦隔离继电器模块PDF原理图+AD集成封装库文件.zip
- 当提及“奇怪的数列”时,我首先想到的是斐波那契数列和康托尔数列,这两个数列因其独特的生成规则和性质而显得与众不同 以下是关于这两
- hbase的安装与简单操作
- LAW100-AI大模型测试集
- Pandas 是一个功能强大的 Python 数据分析库
- 4.12作业.sql.sql
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论1