Online calculation of 1st order lowpass filter [z] = vb_online_lowpass(a,x,z) --- Input a : Coefficient of lowpass filter [D x Nbank] x : Input signal [D x 1] or [D x Nbank] z : Lowpass signal (State variable for online-filter) [D x Nbank] --- Output z : Lowpass signal (Updated value) [D x Nbank] 2007-9-21 Masa-aki Sato Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [z] = vb_online_lowpass(a,x,z) 0002 % Online calculation of 1st order lowpass filter 0003 % [z] = vb_online_lowpass(a,x,z) 0004 % --- Input 0005 % a : Coefficient of lowpass filter [D x Nbank] 0006 % x : Input signal [D x 1] or [D x Nbank] 0007 % z : Lowpass signal (State variable for online-filter) [D x Nbank] 0008 % --- Output 0009 % z : Lowpass signal (Updated value) [D x Nbank] 0010 % 0011 % 2007-9-21 Masa-aki Sato 0012 % 0013 % Copyright (C) 2011, ATR All Rights Reserved. 0014 % License : New BSD License(see VBMEG_LICENSE.txt) 0015 0016 Mx = size(x,2); 0017 Mz = size(z,2); 0018 0019 if Mx == 1, 0020 z = a .* z + x * (1 - a(1,:)); 0021 elseif Mx==Mz 0022 z = a .* z + x .* (1 - a); 0023 end