tomwalters@0: % method of class @signal tomwalters@0: % tomwalters@0: % INPUT VALUES: tomwalters@0: % tomwalters@0: % RETURN VALUE: tomwalters@0: % 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: tomwalters@0: tomwalters@0: function sig=highpass(sig,frequency,stopband,ripple,stopbandatten) tomwalters@0: % hack for an phase true lowpassfilter with cutoff at frequency tomwalters@0: % used is a ButterworthFilter tomwalters@0: tomwalters@0: if nargin < 5 tomwalters@0: stopbandatten=60; % in dB - how many dB the signal is reduced in the stopband at least tomwalters@0: end tomwalters@0: if nargin < 4 tomwalters@0: ripple=1; % in dB = ripple in the passband tomwalters@0: end tomwalters@0: if nargin <3 tomwalters@0: stopband=frequency/2; % eine Oktave drunter tomwalters@0: end tomwalters@0: tomwalters@0: nyquist=getsr(sig)/2; tomwalters@0: fre_low=frequency; tomwalters@0: tomwalters@0: % passband tomwalters@0: wp=[fre_low/nyquist 0.98]; tomwalters@0: tomwalters@0: % stopband tomwalters@0: ws=[(fre_low-stopband)/nyquist 0.99]; tomwalters@0: tomwalters@0: % Finde raus, wieviel Punkte der Filter dafür haben muss tomwalters@0: [n,Wn] = buttord(wp,ws,ripple,stopbandatten); tomwalters@0: % Berechne den IIR-Filter tomwalters@0: [b,a] = butter(n,Wn); tomwalters@0: tomwalters@0: % testen: tomwalters@0: % freqz(b,a,512,getsr(sig)); tomwalters@0: tomwalters@0: vals=sig.werte; tomwalters@0: nvals = filtfilt(b,a,vals); tomwalters@0: sig.werte=nvals;