% Butterworth #3
% high pass: <3dB ripple Nyquist-Wp Hz, >=60dB attenuation 0-Ws
% in this case, passband is 0.5-2.5 days, stopband is >8 days

pass_period=2.5;
stop_period=8;

fs=spf;
Ws=1/stop_period; Wp=1/pass_period;

%Ws = (1/(stop_period*2))/(fs/2); Wp = (1/(pass_period*2))/(fs/2);
[n,Wn] = buttord(Wp,Ws,3,60)
[b,a] = butter(n,Wn,'high');

%plot the filter response
[h,w]=freqz(b,a,128,fs);
r=abs(h); %imaginary part has 
rhigh=r.*r; %r r conjugate for double pass
%fr=w/pi/2.0;  %convert from interval 0 to pi (angular frequency) to 0 to .5
figure(2);
plot(w,rhigh, 'b')
title('butterworth #3');

return


% Butterworth #2
% high pass: <3dB ripple Nyquist-Wp Hz, >=60dB attenuation 0-Ws
% in this case, passband is 0.5-5 days, stopband is >10 days
Ws = (1/20)/(fs/2); Wp = (1/10)/(fs/2);
[n,Wn] = buttord(Wp,Ws,3,60)
[b,a] = butter(n,Wn,'high');

