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 %
|
bleeck@3
|
8 % This external file is included as part of the 'aim-mat' distribution package
|
bleeck@3
|
9 % (c) 2011, University of Southampton
|
bleeck@3
|
10 % Maintained by Stefan Bleeck (bleeck@gmail.com)
|
bleeck@3
|
11 % download of current version is on the soundsoftware site:
|
bleeck@3
|
12 % http://code.soundsoftware.ac.uk/projects/aimmat
|
bleeck@3
|
13 % documentation and everything is on http://www.acousticscale.org
|
bleeck@3
|
14
|
tomwalters@0
|
15
|
tomwalters@0
|
16 function ampscale=filterbandamp(fre,amp,fc,df1,bw,df2)
|
tomwalters@0
|
17 % usage: ampscale=filterbandamp(fre,amp,fc,df1,bw,df2)
|
tomwalters@0
|
18 % given a frequency and its associated amplitude, and the defining properties of
|
tomwalters@0
|
19 % a bandpass filter (cf. Krumbholz et al (2000), JASA 108, 1170-1180, Fig.3)
|
tomwalters@0
|
20 % this function returns the amplitude of the frequency component after it has
|
tomwalters@0
|
21 % passed through the filter. The reurned amplitude should be used to SCALE the
|
tomwalters@0
|
22 % amplitude of the given frequency component.
|
tomwalters@0
|
23 % fre frequency in Hz
|
tomwalters@0
|
24 % amp amplitude
|
tomwalters@0
|
25 % fc lower cutoff frequency
|
tomwalters@0
|
26 % df1 lower spectral ramp width
|
tomwalters@0
|
27 % bw bandwidth (of plateau)
|
tomwalters@0
|
28 % df2 upper spectral ramp
|
tomwalters@0
|
29 %
|
tomwalters@0
|
30 % David Smith (16/05/02)
|
tomwalters@0
|
31
|
tomwalters@0
|
32 if (fre<(fc-df1)) | (fre>(fc+bw+df2))
|
tomwalters@0
|
33 ampscale=0; %ignore everything outside passband
|
tomwalters@0
|
34 elseif fre<=fc %lower spectral ramp
|
tomwalters@0
|
35 ampscale=max(cos((fc-fre)*pi/(2*df1)),0); %quarter-cycle of cosine function
|
tomwalters@0
|
36 elseif fre<=fc+bw %flat part of filter
|
tomwalters@0
|
37 ampscale=1;
|
tomwalters@0
|
38 else %upper spectral ramp
|
tomwalters@0
|
39 ampscale=max(cos((fre-(fc+bw))*pi/(2*df2)),0);
|
tomwalters@0
|
40 end |