作者:范二小姐儿 | 来源:互联网 | 2023-10-11 16:09
本文由编程笔记#小编为大家整理,主要介绍了《DSP using MATLAB》Problem 6.21相关的知识,希望对你有一定的参考价值。
代码:
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%% Output Info about this m-file
fprintf(‘
***********************************************************
‘);
fprintf(‘ Problem 6.21
‘);
banner();
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%format long;
format short;
fprintf(‘
FIR filter All-Zero LATTICE-form:
‘);
Klc = [2, 0.6, 0.3, 0.5, 0.9]
% ----------------------------------------------------------
% NOTE: linear-phase can not use LATTICE-form
% ----------------------------------------------------------
fprintf(‘
Convert All-Zero LATTICE-form to DIRECT-form :
‘);
[b] = latc2dir(Klc)
a = 1
fprintf(‘
Convert DIRECT-form to PARALLEL-form :
‘);
[C, Bp, Ap] = dir2par(b, a)
if size(C)==0
C = 0;
end
fprintf(‘
Convert DIRECT-form to CASCADE-form :
‘);
[b0, Bc, Ac] = dir2cas(b, a)
fprintf(‘
Convert TF-form to SOS-form :
‘);
[sos, g] = tf2sos(b, a)
fprintf(‘
Convert DIRECT-form to FREQUENCY-SAMPLE-form 1 :
‘);
[Cfs, Bfs, Afs] = dir2fs(b)
fprintf(‘
Convert DIRECT-form to FREQUENCY-SAMPLE-form 2 :
‘);
r = 0.99;
[Cfs_r, Bfs_r, Afs_r, rM] = dir2fs_r(b, r)
% -----------------------------------------
% START check
% -----------------------------------------
n = [0:7];
delta = impseq(0, 0, 7)
%format long
format short
hcas = casfiltr(b0, Bc, Ac, delta)
hltc = latcfilt(Klc, delta)
%hladr = ladrfilt(Klr, Clr, delta)
hdir = filter(b, a, delta)
% -------------------------------------------
% END check
% -------------------------------------------
运行结果:
得到的直接形式系数
串联形式系数
频率采样形式1系数
频率采样形式2系数
Lattice和直接形式流图