📄 mallate.m
字号:
%%本程序采用Mallat算法对信号进行小波分析
clc;clear;
%%1 定义正弦波
f1=50;%%Frequency1
f2=100;%%Frequency2
fs=2*(f1+f2);%%采样频率
Ts=1/fs;%采样间隔
N=120;
n=1:N;
y=sin(2*pi*f1*n*Ts)+sin(2*pi*f2*n*Ts);%sin blended waves
figure(1);
subplot(2,1,1);
plot(y);
title('Original signal');
subplot(2,1,2);
stem(abs(fft(y)));
title('Frequency spectrum');
%%2 Wavelet filter
h=wfilters('db30','l');%%lowpass filter
g=wfilters('db30','h');%%highpass filter
h=[h,zeros(1,N-length(h))];%add zero(circular convolution)
g=[g,zeros(1,N-length(g))];
figure(2);
subplot(2,1,1)
stem(abs(fft(h)));
title('decompose the spectrum of lowpass filter')
subplot(2,1,2)
stem(abs(fft(g)));
title('decompose the spectrum of highpass filter')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -