bleeck@3: % This external file is included as part of the 'aim-mat' distribution package bleeck@3: % (c) 2011, University of Southampton bleeck@3: % Maintained by Stefan Bleeck (bleeck@gmail.com) bleeck@3: % download of current version is on the soundsoftware site: bleeck@3: % http://code.soundsoftware.ac.uk/projects/aimmat bleeck@3: % documentation and everything is on http://www.acousticscale.org tomwalters@0: tomwalters@0: tomwalters@0: function sig=toshio_lowpass(sig,cutoff,order) tomwalters@0: tomwalters@0: %variable: order, is not used, tomwalters@0: % a 2nd order filter is assumed, tomwalters@0: % taken from Irino code: CalNAPghll.m tomwalters@0: tomwalters@0: tomwalters@0: if nargin<2 tomwalters@0: order=1; tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: sr=getsr(sig); tomwalters@0: vals=getvalues(sig); tomwalters@0: tomwalters@0: [bzLP apLP] = butter(1,cutoff/(sr/2)); tomwalters@0: bzLP2 = [bzLP(1)^2, 2*bzLP(1)*bzLP(2), bzLP(2)^2]; tomwalters@0: apLP2 = [apLP(1)^2, 2*apLP(1)*apLP(2), apLP(2)^2]; tomwalters@0: tomwalters@0: sig_len = length(vals); tomwalters@0: tomwalters@0: filt_vals(1:sig_len) = filter(bzLP2,apLP2,vals); tomwalters@0: vals=filt_vals; tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: sig=setvalues(sig,vals); tomwalters@0: