MKBANDPASS return a bandpass filter miir(). A Cheby filter is used. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: MKBANDPASS return a bandpass filter miir(). A Cheby filter is used. CALL: f = mkbandpass(f, pl) VERSION: $Id: mkbandpass.m,v 1.4 2008/08/06 15:03:50 ingo Exp $ HISTORY: 27-08-2002 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % MKBANDPASS return a bandpass filter miir(). A Cheby filter is used. 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: MKBANDPASS return a bandpass filter miir(). A Cheby filter is used. 0005 % 0006 % CALL: f = mkbandpass(f, pl) 0007 % 0008 % VERSION: $Id: mkbandpass.m,v 1.4 2008/08/06 15:03:50 ingo Exp $ 0009 % 0010 % HISTORY: 27-08-2002 M Hewitson 0011 % Creation 0012 % 0013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0014 0015 function f = mkbandpass(f, pl) 0016 0017 g = find(pl, 'gain'); 0018 fc = find(pl, 'fc'); 0019 fs = find(pl, 'fs'); 0020 order = find(pl, 'order'); 0021 ripple = find(pl, 'ripple'); 0022 0023 if(fc > fs/2) 0024 error('fc must be < fs/2'); 0025 end 0026 if(fc(1) > fc(2)) 0027 error('fc(1) must be < fc(2)'); 0028 end 0029 0030 % Build filter coefficients 0031 [a, b] = cheby1(order, ripple, 2.*fc./fs); 0032 0033 % Set filter properties 0034 f.setName('bandpass', 'internal'); 0035 f.setFs(fs); 0036 f.setA(g.*a); 0037 f.setB(b); 0038 f.setHistin(zeros(1,f.ntaps-1)); % initialise input history 0039 f.setHistout(zeros(1,f.ntaps-1)); % initialise output history 0040 0041