ex.m
来自「在国外网站上找到的一个小波降噪的实例」· M 代码 · 共 37 行
M
37 行
x1=wavread('late_cafe');
x2=x1(1:65536);
s1=auread('late_cafe_out');
s2=s1(1:65536);
%fs=128;
%t=(1:128)/128;
%c1=sin(2*pi*t*8);
%c2=sin(2*pi*t*10);
%c3=sin(2*pi*t*60);
%c4=c1+c2+c3;
%plot(c4)
h = daubcqf(6);
%[s,N] = makesig('HiSine',65536);
%n = randn(1,N);
%x = x2 + n/10; % (approximately 10dB SNR)
% figure;plot(x2);hold on;plot(s2,'r');
%Denoise x with the default method based on the DWT
[xd,xn,opt1] = denoise(x2,h);
figure;plot(x2);hold on;plot(xd,'r');
%Denoise x using the undecimated (LSI) wavelet transform
[yd,yn,opt2] = denoise(x2,h,1,[]);
figure;plot(x2);hold on;plot(yd,'r');
fft1=fft(yd,65536);
fft2=fft(x2,65536);
fft3=fft(s2,65536);
w=(0:32767)/32768*(20000/2);
figure;
plot(w,abs(fft1(1:32768)),'c');
hold on;
figure;
plot(w,abs(fft2(1:32768)),'r');
hold on;
plot(w,abs(fft3(1:32768)),'y');
%legend('denoise','noisy','orignal');
%wavwrite(yd,'clean')
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?