f1= 100;            % signal 1: 100 Hz
f2= 40;             % signal 2: 40 Hz   

T= (1/f1)*1/10;     % sampling period = signal period x 1/10
N= 100;             % 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



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

% H100= zeros(1,N);
% H100(45:55) = 1;
H40= ones(1,N);
H40(45:55) = 0;


Fs1= abs(fftshift(fft(fftshift(s1))));          % frequency domain of sig1
Fs2= abs(fftshift(fft(fftshift(s2))));          % ........ sig2
Fss= abs(fftshift(fft(fftshift(s1+s2))));       % ........ sum of sig1+sig2
%Fsf= Fss .* H100;
Fsf= Fss .* H40;

figure(2)
subplot(4,1,1), plot(Fs1);
subplot(4,1,2), plot(Fs2);
subplot(4,1,3), plot(Fss);
subplot(4,1,4), plot(Fsf);
