% function Hd = test1
%TEST1 Returns a discrete-time filter object.

%
% MATLAB Code
% Generated by MATLAB(R) 7.14 and the Signal Processing Toolbox 6.17.
%
% Generated on: 04-Oct-2016 19:55:09
%

% Equiripple Lowpass filter designed using the FIRPM function.

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

Fpass = 60;              % Passband Frequency
Fstop = 75;              % Stopband Frequency
Dpass = 0.057501127785;  % Passband Ripple
Dstop = 0.01;          % Stopband Attenuation
dens  = 20;              % Density Factor

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

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

% [EOF]
%------------------------------------------------------------------
f1= 100;            % signal 1: 100 Hz
f2= 0;             % signal 2: 40 Hz   

T= (1/f1)*1/10;     % sampling period = signal period x 1/10
N= 200;             % number of points - arbitrary
t= 0:T:(N-1)*T;         % generate time points to use for computing the signal
s1= cos(2*pi*f1*t);  % generate the signal
s2= cos(2*pi*f2*t);  % generate the signal
ss= s1+s2;           % sum signal = s1+s2

ssf= filter(Hd, ss); % filtered signal   

figure(1)
%plot(t,s1,'ro-',t,s2,'bs--')
plot(t,ss,'b',t,ssf,'r')

