function [M2,mn2,df2]=fftseq(x2,ts2,df)
% [M,m,df]=fftseq(m,ts,df)
% [M,m,df]=fftseq(m,ts)
% FFTSEQ Generates M,the FFT of the sequence m.
% The sequence is zero-padded to meet the required frequency resolution df.
% ts is the sampling interval.The output df is the final frequency resolution.
% Output m is the zero-padded version of input m,M is the FFT.
fs=1/ts2;
if nargin == 2
n1=0;
else
n1=fs/df;
end
n2=length(x2);
n=2^(max(nextpow2(n1),nextpow2(n2)));
M2=fft(x2,n);
mn2=[x2,zeros(1,n-n2)];
df2=fs/n;
end