《DSP using MATLAB》Problem 6.23-LMLPHP

代码:

%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 6.23 \n\n'); 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('\nConvert DIRECT-form to Cascade of Two Linear-Phase form : \n');
B1 = real( poly( [broots(1:4)] ) )
B2 = real( poly( [broots(5:8)] ) ) fprintf('\n FIR filter DIRECT-form: \n');
b = real( poly(broots) )
a = 1.0 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 FREQUENCY-SAMPLE-form 1 : \n');
[Cfs, Bfs, Afs] = dir2fs(b) fprintf('\nConvert DIRECT-form to FREQUENCY-SAMPLE-form 2 : \n');
r = 0.99;
[Cfs_r, Bfs_r, Afs_r, rM] = dir2fs_r(b, r) % ----------------------------------------------------------
% NOTE: linear-phase can not use LATTICE-form
% ----------------------------------------------------------
fprintf('\nConvert DIRECT-form to All-Zero LATTICE-form : \n');
[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个零点,即系统函数的分子多项式的根

《DSP using MATLAB》Problem 6.23-LMLPHP

根据线性相位FIR的特点,前4个零点和后4个零点可分为两组,即看成两个线性相位FIR

《DSP using MATLAB》Problem 6.23-LMLPHP

串联形式系数

《DSP using MATLAB》Problem 6.23-LMLPHP

《DSP using MATLAB》Problem 6.23-LMLPHP

频率采样形式系数

《DSP using MATLAB》Problem 6.23-LMLPHP

《DSP using MATLAB》Problem 6.23-LMLPHP

《DSP using MATLAB》Problem 6.23-LMLPHP

05-08 15:24