function [y, N1] = fermi_filt(tc, zero_frac, N)
% zero_frac = min([0.4, zero_frac]);
% fwhm1 = min([1, fwhm + zero_frac]);
% if fwhm1 == 1;
%     fwhm = 1 - zero_frac;
% end;
% fwhm1 = fwhm;
N1 = round((1 - zero_frac)*N);
N1 = N1 - mod(N - N1, 2);
% tc = (1 - fwhm1)/(2*log(2));
% tc = 0.030;
x = linspace(-1, 1, N1);
y = 1./(exp((abs(x) - 1)/(tc + eps)) + 1);
y = y - min(y);
y = y/max(y);
y = [zeros(1, (N - N1)/2), y, zeros(1, (N - N1)/2)];
% figure; plot(y); grid;
% title([' fwhm = ', num2str(fwhm), '. zero frac = ', num2str(zero_frac), '. ']);
