function x = hhp(h,sp,x) %HHP h-Hour High Pass filter % HHP(H,SP,X) filters the input vector X, at the sampling % rate SP, using a 2nd order highpass digital Butterworth % filter, allowing ~< h-hour information to be "PASSED" to % the output. All arguments are REQUIRED. SP must be the % sample rate in hours. The MATLAB routine FILTFILT is % used to perform the actual filtering. % % INPUT: h - Period to high-pass (hours) % sp - sampling rate (hours) % x - signal % OUTPUT: y - h-hour high passed version of input x % % CALL AS: y=hhp(40,sp,x); % for 40-hour high pass % Brian Blanton, Fall 1998 % if nargin==0 & nargout==0 disp('Call as: y=hhp(H,sample_rate,x);') return end wn=cutoff(sp,h); [b,a] = butter(2,wn,'high'); x = filtfilt(b, a, x);