Hi,
Here is the MATLAB code for designing an FIR filter:
L = 5;
M = 3;
% Obtain the value of the filter cutoff frequency
fc = min(0.5/M, 0.5/L);
N = 60; % Filter order
% Calculation of the filter coefficients with the function fir1
% Note that you must multiply the value of fc by 2
B = fir1(N, 2*fc);
% Obtain the frequency response with freqz
A = 1;
[H, W] = freqz(B, A);
% Convert W to normalized frequency
f = W / (2*pi);
% Representation on linear scale
figure(1);
plot(f, abs(H));
title('Frequency response (linear scale)');
xlabel('Normalized frequency');
ylabel('abs(H)');
% Convert the result to dBs
Hdb = 20*log10(abs(H));
% Representation in dBs
figure(2);
plot(f, Hdb);
title('Frequency response (dBs scale)');
xlabel('Normalized frequency');
ylabel('abs(H) (dB)');
% Once you run the script, uncomment the following line and complete it with the value observed in the minAttenuation graph
% minAttenuation = 52.3626;
I hope this helps!