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 2007/08/16 13:27:32 ingo Exp $ HISTORY: 27-08-2002 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function f = mklowpass(f, pl) 0002 % MKLOWPASS return a low pass filter miir(). A Butterworth filter is used. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: MKLOWPASS return a low pass filter miir(). 0007 % A Butterworth filter is used. 0008 % 0009 % CALL: f = mklowpass(f, pl) 0010 % 0011 % VERSION: $Id: mklowpass.m,v 1.4 2007/08/16 13:27:32 ingo Exp $ 0012 % 0013 % HISTORY: 27-08-2002 M Hewitson 0014 % Creation 0015 % 0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 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 f.name = 'std lowpass'; 0028 f.fs = fs; 0029 f.ntaps = order+1; 0030 [f.a, f.b] = butter(order, 2*fc/fs); 0031 f.g = g; 0032 f.histin = zeros(1,f.ntaps-1); % initialise input history 0033 f.histout = zeros(1,f.ntaps-1); % initialise output history 0034 0035 % END 0036