exa050904_latcfilt.m
来自「关于数字信号处理算法与实现详细代码...没有比这更详细的了.经典!超经典」· M 代码 · 共 28 行
M
28 行
% ------------------------------------------------------------------------------
% exa050904_latcfilt.m , for example 5.9.4
%to test latcfilt.m and to realize filtering with LATTICE coefficient.
% ------------------------------------------------------------------------------
clear;
% 给定 IIR滤波器;
B=[0.0201 0 -0.0402 0 0.0201];
A=[1 -1.637 2.237 -1.307 0.641];
% 产生信号 x;
w1=0.1*pi;w2=0.35*pi;
N=100;n=0:N-1;
x=cos(w1*n)+cos(w2*n);
%直接滤波;
y1=filter(B,A,x);
% 求出lattice 系数;
[k,c]=tf2latc(B,A);
% 用lattice 系数滤波;
[y2,g]=latcfilt(k,c,x);
subplot(411);plot(x(10:N-1));grid on;
subplot(412);plot(y1(10:N-1));grid on;
subplot(413);plot(y2(10:N-1));grid on;
subplot(414);plot(g(10:N-1));grid on;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?