代码:
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info about this m-file fprintf(' *********************************************************** '); fprintf(' <DSP using MATLAB> Problem 6.23 '); banner(); %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %format long; format short; broots = [0.5*exp(j*pi/3), 0.5*exp(-j*pi/3), 2*exp(j*pi/3), 2*exp(-j*pi/3), ... 0.25*exp(j*pi/6), 0.25*exp(-j*pi/6), 4*exp(j*pi/6), 4*exp(-j*pi/6)] fprintf(' Convert DIRECT-form to Cascade of Two Linear-Phase form : '); B1 = real( poly( [broots(1:4)] ) ) B2 = real( poly( [broots(5:8)] ) ) fprintf(' FIR filter DIRECT-form: '); b = real( poly(broots) ) a = 1.0 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) % ---------------------------------------------------------- % NOTE: linear-phase can not use LATTICE-form % ---------------------------------------------------------- fprintf(' Convert DIRECT-form to All-Zero LATTICE-form : '); [Klc] = dir2latc(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 % -------------------------------------------
运行结果:
8个零点,即系统函数的分子多项式的根
根据线性相位FIR的特点,前4个零点和后4个零点可分为两组,即看成两个线性相位FIR
串联形式系数
频率采样形式系数