《DSP using MATLAB》Problem 6.8

《DSP using MATLAB》Problem 6.8

代码:

%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 6.8 \n\n'); banner();
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
b1 = [-14.75 -12.90]; nb1 = [0:1];
b2 = [ 24.5 26.82]; nb2 = [0:1];
b3 = [ 1 2 1]; nb3 = [0:2]; a1 = [1 -7/8 3/32]; na1 = [0:2];
a2 = [1 -1 0.5]; na2 = [0:2];
a3 = [1 0 0.81]; na3 = [0:2]; a11 = conv(a2, a3); b11 = conv(b2, b3); fprintf('\nDirect form: \n');
b = conv(b1, a11) + conv(a1, b11)
a = conv(a11, a1) 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.8 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.8 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;

  运行结果:

直接形式系数

《DSP using MATLAB》Problem 6.8

并联形式系数

《DSP using MATLAB》Problem 6.8

《DSP using MATLAB》Problem 6.8

《DSP using MATLAB》Problem 6.8

《DSP using MATLAB》Problem 6.8

串联形式系数

《DSP using MATLAB》Problem 6.8

《DSP using MATLAB》Problem 6.8

格型系数

《DSP using MATLAB》Problem 6.8

《DSP using MATLAB》Problem 6.8

上一篇:java类的继承,多态,抽象类与接口


下一篇:《DSP using MATLAB》Problem 2.16