order = 40; % order of filter
Fs = 8000; % sampling rate
N_Fs = Fs/2; % half of sampling rate
h = firls(order, [0, 3200/N_Fs, 3400/N_Fs, 3600/N_Fs, 3800/N_Fs, 1], [1,1,0.7071, 0.06, 0.01, 0]); % length of h is order + 1.
fvtool(h); % for filter analysis, such as mangnitude/phase...
fid = fopen('coeff.h', 'w+t'); % save filter coefficients to coeff.h
fprintf(fid, 'coeff[%d] = {\n', N+1);
for i=1:40
fprintf(fid, '\t%.15f,\n',h(i));
end
fprintf(fid, '\t%.15f\n', h(41));
fprintf(fid, '}\n');
fclose(fid);