声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1390|回复: 2

[综合讨论] 求小波分解的程序

[复制链接]
发表于 2007-5-30 19:07 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
哪位高手有小波分解的程序.我做毕业设计要一个来参考.谢谢了.

[ 本帖最后由 eight 于 2007-5-30 19:11 编辑 ]
回复
分享到:

使用道具 举报

 楼主| 发表于 2007-5-30 19:09 | 显示全部楼层
这个程序是关于滤波器的.现在没有找到能参考的.
发表于 2007-5-30 19:34 | 显示全部楼层

不知道你要什么小波分解的程序啊?
现在的论坛上已经有好多相关的帖子了,你可以搜一下.
我这有一个DB10的,发给你参考一下吧 .

%含噪的三角波与正弦波的组合
%生成正弦信号
clc;
clear;
close all;
N=1000;
t=0:0.001:0.6;
x=sin(2*pi*50*t)+sin(2*pi*120*t);
y=x+2*randn(size(t));
figure;
subplot(211)
plot(t,y,'LineWidth',2);
subplot(212)
plot(1000*t(1:50),y(1:50));
%xlabel('sample number n');
%ylabel('amplitude A');
%wavelet 1D decompose
[c,l]=wavedec(y,7,'db10');
% 低频重构.
a7=wrcoef('a',c,l,'db10',7);
a6=wrcoef('a',c,l,'db10',6);
a5=wrcoef('a',c,l,'db10',5);
a4=wrcoef('a',c,l,'db10',4);
a3=wrcoef('a',c,l,'db10',3);
a2=wrcoef('a',c,l,'db10',2);
a1=wrcoef('a',c,l,'db10',1);

%
figure
subplot(7,1,1);
plot(a7,'LineWidth',2);
ylabel('a7');
subplot(7,1,2);
plot(a6,'LineWidth',2);
ylabel('a6');
subplot(7,1,3);
plot(a5,'LineWidth',2);
ylabel('a5');
subplot(7,1,4);
plot(a4,'LineWidth',2);
ylabel('a4');
subplot(7,1,5);
plot(a3,'LineWidth',2);
ylabel('a3');
subplot(7,1,6);
plot(a2,'LineWidth',2);
ylabel('a2');
subplot(7,1,7);
plot(a1,'LineWidth',2);
ylabel('a1');
xlabel('sample sequence n');
% 高频重构
d7=wrcoef('d',c,l,'db10',7);
d6=wrcoef('d',c,l,'db10',6);
d5=wrcoef('d',c,l,'db10',5);
d4=wrcoef('d',c,l,'db10',4);
d3=wrcoef('d',c,l,'db10',3);
d2=wrcoef('d',c,l,'db10',2);
d1=wrcoef('d',c,l,'db10',1);
% show detail coefficient
figure
subplot(7,1,1);
plot(d7,'LineWidth',2);
ylabel('d7');
subplot(7,1,2);
plot(d7,'LineWidth',2);
ylabel('d6');
subplot(7,1,3);
plot(d5,'LineWidth',2);
ylabel('db5');
subplot(7,1,4);
plot(d5,'LineWidth',2);
ylabel('d4');
subplot(7,1,5);
plot(d3,'LineWidth',2);
ylabel('d3');
subplot(7,1,6);
plot(d2,'LineWidth',2);
ylabel('d2');
subplot(7,1,7);
plot(d1,'LineWidth',2);
ylabel('d1');
xlabel('sample squence n');

%%%%%%%%%%%%%%%
fs=1000;
Y2=fft(a1,512);
Pyy2=Y2.*conj(Y2)/512;
f2=1000*(0:256)/512;
y=hilbert(a1);
ydata=abs(y);
y=y-mean(y);
nfft=1000;
p=abs(fft(ydata,nfft));

y1=hilbert(d1);
ydata1=abs(y1);
y1=y1-mean(y1);
nfft=1000;
p1=abs(fft(ydata1,nfft));
  
  
figure
subplot(311)
plot((0:nfft/2-1)/nfft*fs,p(1:nfft/2));
subplot(312)
plot((0:nfft/2-1)/nfft*fs,p1(1:nfft/2));
subplot(313)
plot(f2,Pyy2(1:257));

评分

1

查看全部评分

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-24 09:21 , Processed in 0.063416 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表