代码:
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info about this m-file fprintf(‘\n***********************************************************\n‘); fprintf(‘ <DSP using MATLAB> Problem 6.21 \n\n‘); banner(); %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %format long; format short; fprintf(‘\n FIR filter All-Zero LATTICE-form: \n‘); Klc = [2, 0.6, 0.3, 0.5, 0.9] % ---------------------------------------------------------- % NOTE: linear-phase can not use LATTICE-form % ---------------------------------------------------------- fprintf(‘\nConvert All-Zero LATTICE-form to DIRECT-form : \n‘); [b] = latc2dir(Klc) a = 1 fprintf(‘\nConvert DIRECT-form to PARALLEL-form : \n‘); [C, Bp, Ap] = dir2par(b, a) if size(C)==0 C = 0; end fprintf(‘\nConvert DIRECT-form to CASCADE-form : \n‘); [b0, Bc, Ac] = dir2cas(b, a) fprintf(‘\nConvert TF-form to SOS-form : \n‘); [sos, g] = tf2sos(b, a) fprintf(‘\nConvert DIRECT-form to FREQUENCY-SAMPLE-form 1 : \n‘); [Cfs, Bfs, Afs] = dir2fs(b) fprintf(‘\nConvert DIRECT-form to FREQUENCY-SAMPLE-form 2 : \n‘); 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和直接形式流图
原文地址:https://www.cnblogs.com/ky027wh-sx/p/10276298.html
时间: 2024-11-08 16:26:17