代码:
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 6.15 \n\n'); banner();
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%format long;
format short;
fprintf('\n DIRECT-form: \n');
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('\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 LATTICE-LADDER-form : \n');
[Klr, Clr] = dir2ladr(b, a) fprintf('\nConvert DIRECT-form to MATLAB LATTICE-LADDER-form : \n');
[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('\nConvert 1st part to DIRECT-form from CASCADE-form : \n');
[b1, a1] = cas2dir(b01, Bc1, Ac1)
b1 = b1(1:6);
a1 = a1(1:6); fprintf('\nConvert 1st part to PARALLEL-form from DIRECT-form : \n');
[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('\nConvert 2nd part to DIRECT-form from CASCADE-form : \n');
[b2, a2] = cas2dir(b02, Bc2, Ac2)
b2 = b2(1:6);
a2 = a2(1:6); fprintf('\nConvert 2nd part to PARALLEL-form from DIRECT-form : \n');
[C2, Bp2, Ap2] = dir2par(b2, a2) if size(C2)==0
C2 = 0;
end
运行结果:
直接形式系数
并联形式系数
串联形式系数
由总的直接形式转换成串联形式,再分成两部分的串联,这两部分写成并联形式,而后串联。
第1部分的并联形式
第2部分的并联形式
题中的附图,系数标注不准的地方直接改了。