% Fs --Data rate
% Fpass --pass band
% Fstop --Cutoff frequencies
% Apass --Passband ripple
% Astop --Stopband ripple
% Q_Bit --Quantization bits
function coef = LowPassFir(Fs,Fpass,Fstop,Apass,Astop,Q_Bit)
dens = 20; % Density Factor
a = [1 0]; % Desired amplitudes
rp = Apass;
rs = Astop;
% Compute deviations
dev = [(10^(rp/20)-1)/(10^(rp/20)+1),10^(-rs/20)];
% Calculate the order from the parameters using FIRPMORD.
[N, Fo, Ao, W] = firpmord([Fpass, Fstop]/(Fs/2), a, dev);
% Calculate the coefficients using the FIRPM function.
coef = firpm(N, Fo, Ao, W, {dens});
coe = coef;
fft_coe = 20*log(abs(fft(coe,1024)))/log(10);
% x_f = [0:(Fs/length(fft_coe)):Fs/2];
% m = fft_coe(1:length(x_f));
% plot(x_f,m),grid
fft_shift_coe = fftshift(fft_coe);
x_f = [-Fs/2+(Fs/length(fft_shift_coe)):(Fs/length(fft_shift_coe)):Fs/2];
plot(x_f,fft_shift_coe);grid