/usr/share/psychtoolbox-3/PsychSignal/Bandpass.m is in psychtoolbox-3-common 3.0.14.20170103+git6-g605ff5c.dfsg1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | function w=Bandpass(n,fLow,fHigh)
% w=Bandpass(n,fLow,fHigh) returns a 1xn window, a band-pass filter. The
% elements represent gain at each freq, uniformly spaced from -1 to 1 of
% Nyquist frequency. fLow and fHigh are the positive cut-off frequencies
% on this scale. We pass frequencies in the interval [fLow,fHigh). The
% asymmetric use of bounds guarantees that complementary filters will add
% to 1: Bandpass(n,0,f)+Bandpass(n,f,Inf)==ones(1,n). If fHigh is omitted
% it's assumed to be Inf. Also see Bandpass2.
% 1994 dgp Wrote it
% 7/3/96 jny & dgp Replaced erroneous formula for freqs by FREQSPACE.
if nargin<2 || nargin>3
error('Usage: w=Bandpass(n,fLow,[fHigh])')
end
if nargin<3
fHigh=Inf;
end;
if n<2 | n~=floor(n)
error('First arg ''n'' must be an integer greater than 1')
end
if fLow<0 | fHigh<0
error('Frequencies can''t be negative')
end
if rem(n,2) % copied from FREQSPACE
t=-1+1/n:2/n:1-1/n;
else
t=-1 :2/n:1-2/n;
end
t=abs(t);
w=ones(size(t)); % start with all-pass filter
d=find(t<fLow | t>=fHigh); % find out-of-band frequencies
if ~isempty(d)
w(d)=zeros(size(d)); % zero the gain at those frequencies
end
|