代码:
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 6.10 \n\n'); banner();
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
b = [0.05 -0.01 -0.13 0.00 0.13 0.01 -0.05];
a = [1.00 -0.77 1.59 -0.88 1.20 -0.35 0.31]; format short;
fprintf('\nConvert DIRECT-form to PARALLEL-form : \n');
[C, Bp, Ap] = dir2par(b, a)
%C = 0; 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
% ------------------------------------------- figure('NumberTitle', 'off', 'Name', 'P6.10 hcas(n), hpar(n)')
set(gcf,'Color','white');
subplot(2,1,1); stem(n, hcas);
xlabel('n'); ylabel('hcas(n)');
title('hcas(n)'); grid on;
subplot(2,1,2); stem(n, hpar);
xlabel('n'); ylabel('hpar(n)');
title('hpar(n)'); grid on; figure('NumberTitle', 'off', 'Name', 'P6.10 hladr(n) hdir(n)')
set(gcf,'Color','white');
subplot(2,1,1); stem(n, hladr);
xlabel('n'); ylabel('hladr(n)');
title('hladr(n)'); grid on;
subplot(2,1,2); stem(n, hdir);
xlabel('n'); ylabel('hdir(n)');
title('hdir(n)'); grid on;
运行结果:
串联形式系数
题中的系数方框填写如下
上图中的系数填写不是唯一的,因为串联形式又三个双二阶滤波器构成,其中每一个的分子、分母都可以灵活调整,所以
上图的串联形式只是其中的一种。