用matlab画小波基函数,不用wavefun函数
时间: 2024-03-22 09:41:13 浏览: 73
除了使用`wavefun`函数之外,我们还可以手动构造小波基函数,但是需要对小波基函数的理论有一定的了解。
这里以Daubechies小波基函数为例,介绍如何手动构造小波基函数,并用MATLAB绘制它们的图像。
Daubechies小波基函数的构造过程如下:
1.根据小波基函数的阶数n,构造一个长度为2n的系数向量h,其中h[1]至h[n]为低通滤波器系数,h[n+1]至h[2n]为高通滤波器系数。
2.根据h的奇偶性,构造一个长度为2n的系数向量g,其中g[1]至g[n]为低通滤波器系数,g[n+1]至g[2n]为高通滤波器系数。
3.根据h和g,构造一个正交的小波函数族。具体来说,我们可以用h和g的插值来构造一个小波函数phi(x),然后用phi(x)和phi(x-1)的差值来构造一个小波函数psi(x)。这里的插值和差值操作,可以用卷积和下采样来实现。
下面给出Daubechies-4小波基函数的构造代码和绘图示例:
```matlab
% 构造Daubechies-4小波基函数
h = [0.482962913145 0.836516303738 0.224143868042 -0.129409522551];
g = [-0.129409522551 -0.224143868042 0.836516303738 -0.482962913145];
% 构造phi(x)和psi(x)函数
phi = conv(h, [1 1]);
psi = conv(g, [1 1]);
% 绘制phi(x)和psi(x)函数的图像
x = 0:length(phi)-1;
subplot(2,1,1); plot(x, phi); title('Daubechies-4小波基函数-phi(x)');
subplot(2,1,2); plot(x, psi); title('Daubechies-4小波基函数-psi(x)');
```
运行以上代码后,将会绘制出Daubechies-4小波基函数的phi(x)和psi(x)函数的图像。你可以根据需要,手动构造其他小波基函数,并用MATLAB绘制它们的图像。
阅读全文
相关推荐


















