代码:
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info about this m-file fprintf(' *********************************************************** '); fprintf(' <DSP using MATLAB> Problem 6.15 '); banner(); %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %format long; format short; fprintf(' DIRECT-form: '); b = [1.0 0 -2.20 0 1.6368 0 -0.48928 0 5395456*10^(-8) 0 -147456*10^(-8) ] a = [1.0 0 -1.65 0 0.8778 0 -0.17281 0 1057221*10^(-8) 0 -893025*10^(-10)] 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 LATTICE-LADDER-form : '); [Klr, Clr] = dir2ladr(b, a) fprintf(' Convert DIRECT-form to MATLAB LATTICE-LADDER-form : '); [K, V] = tf2latc(b, a) % ----------------------------------------- % START check % ----------------------------------------- n = [0:7]; delta = impseq(0, 0, 7) %format long format short hcas = casfiltr(b0, Bc, Ac, delta) hpar = parfiltr(C, Bp, Ap, delta) hladr = ladrfilt(Klr, Clr, delta) hdir = filter(b, a, delta) % ------------------------------------------- % END check % ------------------------------------------- b01 = 1; Bc1 = [1.0 1.8 0.8; 1.0 1.0 0.24; 1.0 0.2 0; ]; Ac1 = [1.0 1.6 0.63; 1.0 0.8 0.15; 1.0 0.1 0;]; fprintf(' Convert 1st part to DIRECT-form from CASCADE-form : '); [b1, a1] = cas2dir(b01, Bc1, Ac1) b1 = b1(1:6); a1 = a1(1:6); fprintf(' Convert 1st part to PARALLEL-form from DIRECT-form : '); [C1, Bp1, Ap1] = dir2par(b1, a1) if size(C1)==0 C1 = 0; end b02 = 1; Bc2 = [1.0 -1.0 0.24; 1.0 -1.8 0.80; 1.0 -0.2 0.00; ]; Ac2 = [1.0 -0.8 0.15; 1.0 -1.6 0.63; 1.0 -0.1 0.00;]; fprintf(' Convert 2nd part to DIRECT-form from CASCADE-form : '); [b2, a2] = cas2dir(b02, Bc2, Ac2) b2 = b2(1:6); a2 = a2(1:6); fprintf(' Convert 2nd part to PARALLEL-form from DIRECT-form : '); [C2, Bp2, Ap2] = dir2par(b2, a2) if size(C2)==0 C2 = 0; end
运行结果:
直接形式系数
并联形式系数
串联形式系数
由总的直接形式转换成串联形式,再分成两部分的串联,这两部分写成并联形式,而后串联。
第1部分的并联形式
第2部分的并联形式
题中的附图,系数标注不准的地方直接改了。