% Comb filter implementation
% --------------------------
% Set the number of time instants
L=4096;
% Create an array of time instants
time=[0:L-1]*1/L;
% Lower and upper frequencies
f=[ 8 64 ]; % Hz 
frequency=f(1)+((f(2)-f(1))/(time(L)-time(1))).*time;
% Generate a sweep signal
signal=sin(2*pi*frequency.*time);
% Filter delay (in samples)
d=256; % notches at multiple of 8 Hz
out=signal(d+1:L)+signal(1:L-d);
% Plot the output
plot(frequency(d+1:L),out);
% Annotations
ylabel('Amplitude (V)');
xlabel('Frequency (Hz)');
grid on;