《DSP using MATLAB》Problem 6.22

《DSP using MATLAB》Problem 6.22

代码:

%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 6.22 \n\n'); banner();
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%format long;
format short; fprintf('\n FIR filter DIRECT-form: \n');
h = [1, -4, 6.4, -5.12, 2.048, -0.32768]; b = h
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
% ------------------------------------------- % +++++++++++++++++++++++++++++++++++++++++++++++++
% 5 1st-order section CASCADE-form
% +++++++++++++++++++++++++++++++++++++++++++++++++
broots = roots(b)
L = length(broots)
B1 = ones(L, 2); fprintf('\nConvert DIRECT-form to %d 1st-order section : \n', L);
for i = 1:1:L
B1(i,:) = poly( broots(i) );
end
B1 % +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
% CASCADE-form of 1 1st-order section and 2 2nd-order section
% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
fprintf('\nConvert DIRECT-form to One 1st-order and Two 2nd-order section: \n');
B2 = poly( [broots(1), broots(2)] )
B3 = poly( [broots(3), broots(4)] )
B4 = poly( broots(5) ) % +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
% CASCADE-form of 1 2nd-order section and 1 3rd-order section
% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
fprintf('\nConvert DIRECT-form to One 2nd-order and One 3rd-order section: \n');
B5 = poly( [broots(1), broots(2)] )
B6 = poly( [broots(3), broots(4), broots(5)] )

  运行结果:

直接形式的系数

《DSP using MATLAB》Problem 6.22

串联形式系数

《DSP using MATLAB》Problem 6.22

《DSP using MATLAB》Problem 6.22

频率采样形式系数

《DSP using MATLAB》Problem 6.22

《DSP using MATLAB》Problem 6.22

格型Lattice形式系数

《DSP using MATLAB》Problem 6.22

求出5个零点

《DSP using MATLAB》Problem 6.22

《DSP using MATLAB》Problem 6.22

《DSP using MATLAB》Problem 6.22

《DSP using MATLAB》Problem 6.22

《DSP using MATLAB》Problem 6.22

《DSP using MATLAB》Problem 6.22

上一篇:每一对顶点间最短路径的Floyd算法


下一篇:bzoj 1192 鬼谷子的钱袋 数学