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