MATLAB: Digital low pass FIR filter design where the cut off frequency is stuck at around -6db

cut-off frequencydigital filterfirfrequency responsewindowing

I am designing a digital FIR filter using Matlab to the specification of a 5KHz cut off frequency, however, no matter what order number(N), sampling frequency(fs) or window I use, I cannot get the cut off frequency(fc) below -6dB (to -3dB)?
Is this a quirk with MatLab or am I doing something wrong?
If I use an odd order number: 5KHz is around -15dB If I use an even order number: 5KHz is around -6dB
I have attached a screenshot of my frequency response at the moment. The code used to produce it is below:
%filter parameters
fc = 5000; %5KHz cut off freq
fs = 20000;
N = 18;
h = fir1((N-1), (fc/fs)*2, 'low',bartlett(N), 'noscale');
fvtool(h, 'Fs', fs)

Best Answer

The cutoff frequency is defined as the half-power point, corresponding to -6 dB. If you want the filter to be -3 dB down at a certain frequency, the firls function would be worth considering.