% FIR 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);
% Coefficients
a0=0.5;
a5=2.5;
a35=5;
% Filter delays (in samples)
d5=5; 
d35=35;
out=a0*signal(d35+1:L) + a5*signal(d35-d5+1:L-d5) + a35*signal(1:L-d35);
% Plot the output
plot(frequency(d35+1:L),out);
% Annotations
ylabel('Amplitude (V)');
xlabel('Frequency (Hz)');