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.5 2007/10/24 10:55:11 ingo Exp $ HISTORY: 27-08-2002 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function f = mkbandpass(f, pl) 0002 % MKBANDPASS return a bandpass filter miir(). A Cheby filter is used. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: MKBANDPASS return a bandpass filter miir(). A Cheby filter is used. 0007 % 0008 % CALL: f = mkbandpass(f, pl) 0009 % 0010 % VERSION: $Id: mkbandpass.m,v 1.5 2007/10/24 10:55:11 ingo Exp $ 0011 % 0012 % HISTORY: 27-08-2002 M Hewitson 0013 % Creation 0014 % 0015 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 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 0031 f.name = 'std bandpass'; 0032 f.fs = fs; 0033 f.ntaps = 2*order+1; 0034 [f.a, f.b] = cheby1(order, ripple, 2.*fc./fs); 0035 f.gain = g; 0036 f.histin = zeros(1,f.ntaps-1); % initialise input history 0037 f.histout = zeros(1,f.ntaps-1); % initialise output history 0038 0039 % END 0040