?? multiband.m
字號:
function [DH,DW] = multiband(N, F, GF, W, mags, delay)
%MULTIBAND Desired frequency response for multiband filters.
% CREMEZ(N,F,{'multiband', M} ...) designs a linear-phase multiband
% filter response using CREMEZ, where M is a vector of magnitudes,
% one per band edge given in F.
%
% CREMEZ(N,F,{'multiband', M, D}, ...) specifies group-delay offset D
% such that the filter response will have a group delay of N/2 + D in
% units of the sample interval, where N is the filter order.
% Negative values create less delay, while positive values create
% more delay. By default, D=0.
%
% The symmetry option SYM defaults to 'even' if unspecified in the
% call to CREMEZ, if no negative band edge frequencies are
% specified in F.
%
% EXAMPLE: Design a 31-tap, complex lowpass filter
% b = cremez(30,[-1 -.5 -.4 .7 .8 1],{'multiband',[0 0 1 2 0 0]});
% freqz(b,1,512,'whole');
%
% EXAMPLE: Reduced group delay filter response:
% b = cremez(30,[-1 -.5 -.4 .7 .8 1],{'multiband',[0 0 1 2 0 0],-1});
% See also CREMEZ.
% Authors: L. Karam, J. McClellan
% Revised: October 1996, D. Orofino
%
% Copyright (c) 1988-98 by The MathWorks, Inc.
% $Revision: 1.6 $ $Date: 1997/11/26 20:14:24 $
% [DH,DW]=MULTIBAND(N,F,GF,W,MAGS,DELAY)
% N: filter order (length minus one)
% F: vector of band edges
% GF: vector of frequencies at which to evaluate
% W: vector of weights, one per band
% MAGS: vector of mags, one per band edge
% DELAY: negative slope of the phase.
% N/2=(L-1)/2 for exact linear phase.
%
% DH: vector of desired filter response (mag & phase)
% DW: vector of weights (positive)
%
% NOTE: DH(GF) and DW(GF) are specified as functions of frequency
% Ex. 1: Assymetric complex response:
% b=cremez(32,[-.8 -.5 -.3 .2 .4 .6],[1 1 0 0 1 1]);
%
% Support query by CREMEZ for the default symmetry option:
if nargin==2,
% Return symmetry default:
if strcmp(N,'defaults'),
% Second arg (F) is cell-array of args passed later to function:
num_args = length(F);
% Get the delay value:
if num_args<6, delay=0; else delay=F{6}; end
% Use delay arg to base symmetry decision:
if isequal(delay,0), DH='even'; else DH='real'; end
return
end
end
% Standard call:
error(nargchk(4,6,nargin));
if nargin<5,
error(['Multiband designs requires specification of a ' ...
'magnitude vector']);
end
if nargin<6, delay = 0; end
delay = delay + N/2; % adjust for linear phase
W = [1;1] * (W(:).');
DH = table1([F(:), mags(:)], GF) .* exp(-1i*pi*GF*delay);
DW = table1([F(:), W(:)], GF);
% end of multiband.m
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -