Digital Signal Processing Reference
In-Depth Information
function [hpac] = compacLPF(h);
%
% compacLPF
returns the compacted half-band low-pass FIR filter
%
coefficients. All zero values are removed from
%
the filter leaving half its original length. The output is
%
then further reduced by half due to the symmetry of the
%
filter. Final length is approximately quarter of its
%
original length.
%
% Usage:
[hpac] = compacLPF(h)
%
% Input:
h,
full length half-band filter coefficients
%
% Output:
hpac,
compacted half-band filter coefficients
%
% Notes:
(1) The input filter h must be full length containing
%
symmetry about center coefficient h(L/2+1).
%
(2) L must be even.
%
(3) The output filter hpac uses the symmetry of h after zero
%
removal and therefore is one quarter of the original length.
%
(4) h should be either a single column or row vector.
%
%
[r,c] = size(h); if (r > 1)&(c == 1) h = h'; end
[r,c] = size(h); L = length(h)-1;
hpac(1:fix(L/4)) = 0;
if (r == 1)&(c > 1)
R = rem(L,2);
if R == 0
R1 = rem(L,4);
if R1 == 0
P = L/4;
hpac(1:P) = h(2:2:2*P);
hpac(P+1) = h(L/2+1);
elseif R1 ~= 0
P = floor(L/4)+1;
hpac(1:P) = h(1:2:2*P-1);
hpac(P+1) = h(L/2+1);
end
elseif R ~= 0
disp('compac warning: filter length must be odd.');
end
else
disp('compac warning: h must be a row or column vector.');
end
return
function used to compact half-band low-pass filters.
Figure 2.24 Matlab
Search WWH ::




Custom Search