代码:
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info about this m-file fprintf(' *********************************************************** '); fprintf(' <DSP using MATLAB> Problem 6.17 '); banner(); %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %format long; format short; fprintf(' FIR filter DIRECT-form: '); k = [0:6]; b = exp(-0.9*abs(k-3)) a = 1.0 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) % ---------------------------------------------------------- % NOTE: linear-phase can not use LATTICE-form % ---------------------------------------------------------- fprintf(' Convert DIRECT-form to All-Zero LATTICE-form : '); [Klc] = dir2latc(b) fprintf(' Convert DIRECT-form to FREQUENCY-SAMPLE-form : '); [Cfs, Bfs, Afs] = dir2fs(b) % ----------------------------------------- % 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 % -------------------------------------------
运行结果:
直接结构形式系数
串联结构形式系数:
由差分方程和系统函数的关系得知,该系统脉冲响应是第I类线性相位,故没有Lattice形式。