annotate aim-mat/tools/@signal/toshio_lowpass.m @ 4:537f939baef0 tip

various bug fixes and changed copyright message
author Stefan Bleeck <bleeck@gmail.com>
date Tue, 16 Aug 2011 14:37:17 +0100
parents 20ada0af3d7d
children
rev   line source
bleeck@3 1 % This external file is included as part of the 'aim-mat' distribution package
bleeck@3 2 % (c) 2011, University of Southampton
bleeck@3 3 % Maintained by Stefan Bleeck (bleeck@gmail.com)
bleeck@3 4 % download of current version is on the soundsoftware site:
bleeck@3 5 % http://code.soundsoftware.ac.uk/projects/aimmat
bleeck@3 6 % documentation and everything is on http://www.acousticscale.org
tomwalters@0 7
tomwalters@0 8
tomwalters@0 9 function sig=toshio_lowpass(sig,cutoff,order)
tomwalters@0 10
tomwalters@0 11 %variable: order, is not used,
tomwalters@0 12 % a 2nd order filter is assumed,
tomwalters@0 13 % taken from Irino code: CalNAPghll.m
tomwalters@0 14
tomwalters@0 15
tomwalters@0 16 if nargin<2
tomwalters@0 17 order=1;
tomwalters@0 18 end
tomwalters@0 19
tomwalters@0 20
tomwalters@0 21 sr=getsr(sig);
tomwalters@0 22 vals=getvalues(sig);
tomwalters@0 23
tomwalters@0 24 [bzLP apLP] = butter(1,cutoff/(sr/2));
tomwalters@0 25 bzLP2 = [bzLP(1)^2, 2*bzLP(1)*bzLP(2), bzLP(2)^2];
tomwalters@0 26 apLP2 = [apLP(1)^2, 2*apLP(1)*apLP(2), apLP(2)^2];
tomwalters@0 27
tomwalters@0 28 sig_len = length(vals);
tomwalters@0 29
tomwalters@0 30 filt_vals(1:sig_len) = filter(bzLP2,apLP2,vals);
tomwalters@0 31 vals=filt_vals;
tomwalters@0 32
tomwalters@0 33
tomwalters@0 34
tomwalters@0 35 sig=setvalues(sig,vals);
tomwalters@0 36