bleeck@3: % method of class @signal bleeck@3: % bleeck@3: % INPUT VALUES: bleeck@3: % bleeck@3: % RETURN VALUE: bleeck@3: % bleeck@3: % 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 bleeck@3: bleeck@3: function filtered_sig=bandpass(sig,lowfrequency,highfrequency,stopbandwidth_low,stopbandwidth_high,ripple,stopbandatten) bleeck@3: % hack for an phase true bandpassfilter with cutoff at frequency bleeck@3: % used is a ButterworthFilter bleeck@3: % this is all crap, but it does not work properly otherwise. bleeck@3: bleeck@3: grafix=0; bleeck@3: bleeck@3: if nargin < 7 bleeck@3: stopbandatten=60; % in dB - how many dB the signal is reduced in the stopband at least bleeck@3: end bleeck@3: if nargin < 6 bleeck@3: ripple=3; % in dB = ripple in the passband bleeck@3: end bleeck@3: if nargin < 5 bleeck@3: stopbandwidth_high=highfrequency*2; % one octave above bleeck@3: end bleeck@3: if nargin < 4 bleeck@3: stopbandwidth_low=lowfrequency/2; % one octave above bleeck@3: end bleeck@3: bleeck@3: % I dont understand enough to make it work with a butterwort filer. bleeck@3: % easy solution: first perform a lowpass, then a highpass filter... bleeck@3: % sorry, Thanks for any help! bleeck@3: if grafix bleeck@3: figure(235340); bleeck@3: clf bleeck@3: plot(powerspectrum(sig),[100,getsr(sig)/2],'b') bleeck@3: hold on bleeck@3: end bleeck@3: bleeck@3: if highfrequency>0 && highfrequency0 && lowfrequency