huasir2 发表于 2007-5-30 19:07

求小波分解的程序

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

[ 本帖最后由 eight 于 2007-5-30 19:11 编辑 ]

huasir2 发表于 2007-5-30 19:09

这个程序是关于滤波器的.现在没有找到能参考的.

hector1982 发表于 2007-5-30 19:34

原帖由 huasir2 于 2007-5-30 19:07 发表 http://www.chinavib.com/forum/images/common/back.gif
哪位高手有小波分解的程序.我做毕业设计要一个来参考.谢谢了.
不知道你要什么小波分解的程序啊?
现在的论坛上已经有好多相关的帖子了,你可以搜一下.
我这有一个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
=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]
查看完整版本: 求小波分解的程序