annotate aim-mat/tools/filterbandamp.m @ 0:74dedb26614d

Initial checkin of AIM-MAT version 1.5 (6.4.2011).
author tomwalters
date Fri, 20 May 2011 12:32:31 +0100
parents
children 20ada0af3d7d
rev   line source
tomwalters@0 1 % tool
tomwalters@0 2 %
tomwalters@0 3 % INPUT VALUES:
tomwalters@0 4 %
tomwalters@0 5 % RETURN VALUE:
tomwalters@0 6 %
tomwalters@0 7 %
tomwalters@0 8 % (c) 2003-2008, University of Cambridge, Medical Research Council
tomwalters@0 9 % Maintained by Tom Walters (tcw24@cam.ac.uk), written by Stefan Bleeck (stefan@bleeck.de)
tomwalters@0 10 % http://www.pdn.cam.ac.uk/cnbh/aim2006
tomwalters@0 11 % $Date: 2008-06-10 18:00:16 +0100 (Tue, 10 Jun 2008) $
tomwalters@0 12 % $Revision: 585 $
tomwalters@0 13
tomwalters@0 14 function ampscale=filterbandamp(fre,amp,fc,df1,bw,df2)
tomwalters@0 15 % usage: ampscale=filterbandamp(fre,amp,fc,df1,bw,df2)
tomwalters@0 16 % given a frequency and its associated amplitude, and the defining properties of
tomwalters@0 17 % a bandpass filter (cf. Krumbholz et al (2000), JASA 108, 1170-1180, Fig.3)
tomwalters@0 18 % this function returns the amplitude of the frequency component after it has
tomwalters@0 19 % passed through the filter. The reurned amplitude should be used to SCALE the
tomwalters@0 20 % amplitude of the given frequency component.
tomwalters@0 21 % fre frequency in Hz
tomwalters@0 22 % amp amplitude
tomwalters@0 23 % fc lower cutoff frequency
tomwalters@0 24 % df1 lower spectral ramp width
tomwalters@0 25 % bw bandwidth (of plateau)
tomwalters@0 26 % df2 upper spectral ramp
tomwalters@0 27 %
tomwalters@0 28 % David Smith (16/05/02)
tomwalters@0 29
tomwalters@0 30 if (fre<(fc-df1)) | (fre>(fc+bw+df2))
tomwalters@0 31 ampscale=0; %ignore everything outside passband
tomwalters@0 32 elseif fre<=fc %lower spectral ramp
tomwalters@0 33 ampscale=max(cos((fc-fre)*pi/(2*df1)),0); %quarter-cycle of cosine function
tomwalters@0 34 elseif fre<=fc+bw %flat part of filter
tomwalters@0 35 ampscale=1;
tomwalters@0 36 else %upper spectral ramp
tomwalters@0 37 ampscale=max(cos((fre-(fc+bw))*pi/(2*df2)),0);
tomwalters@0 38 end