%function Hd = bw1
%BW1 Returns a discrete-time filter object.

%
% MATLAB Code
% Generated by MATLAB(R) 7.13 and the Signal Processing Toolbox 6.16.
%
% Generated on: 12-Sep-2015 08:24:59
%

% Equiripple Highpass filter designed using the FIRPM function.

% All frequency values are in Hz.
Fs = 360;  % Sampling Frequency

Fstop = 0.1;            % Stopband Frequency
Fpass = 1;              % Passband Frequency
Dstop = 0.01;           % Stopband Attenuation
Dpass = 0.01;  % Passband Ripple
dens  = 20;             % Density Factor

% Calculate the order from the parameters using FIRPMORD.
[N, Fo, Ao, W] = firpmord([Fstop, Fpass]/(Fs/2), [0 1], [Dstop, Dpass]);

% Calculate the coefficients using the FIRPM function.
b  = firpm(N, Fo, Ao, W, {dens});
Hd = dfilt.dffir(b);

% [EOF]

N2 = mean(grpdelay(Hd)) % filter delay in samples
sigin= s118bw12(1,:);
sigout= filter(Hd,sigin);

sigout_shifted= sigout(N2+1:end);
figure
subplot(3,1,1), plot(sigin(1:10000-N2))
subplot(3,1,2), plot(sigout_shifted)
subplot(3,1,3), plot(sigin(1:10000-N2)-sigout_shifted)

