fftseq()

2025-03-04 04:57:40
推荐回答(1个)
回答1:

%matlab里面没有fftseq()这个函数需要自己编写,编写一个M文件放在你的程序目录下就行了
% MATLAB函数fftseq.m,将时间序列m,采样间隔ts和要求的频率分辨率df作为输入,就得长度为2的幂的序列,
% 这个序列的FFT(M)和所要的频率分辨率。
function [M,m,df]=fftseq(m,ts,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/ts;
if nargin == 2
n1=0;
else
n1=fs/df;
end
n2=length(m);
n=2^(max(nextpow2(n1),nextpow2(n2)));
M=fft(m,n);
m=[m,zeros(1,n-n2)];
df=fs/n;
end