linear_fft.m
来自「挺好的线形FFT生成源码。。。大家多给意见」· M 代码 · 共 20 行
M
20 行
% File: linear_fft.m
% Software given here is to accompany the textbook: W.H. Tranter,
% K.S. Shanmugan, T.S. Rappaport, and K.S. Kosbar, Principles of
% Communication Systems Simulation with Wireless Applications,
% Prentice Hall PTR, 2004.
%
function [fftx,freq] = linear_fft(x,n,ts)
% This function takes n (must be even) time domain samples (real or complex)
% and finds the PSD by taking (fft/n)^2. The two sided spectrum is
% produced by shifting the PSD. The array freq provides the appropriate
% frequency values for plotting purposes.
% By taking 10*log10(psd/max(psd)) the psd is normalized. Values beow 60db
% are set equal to -60 dB.
y = zeros(1,n);
for k=1:n
freq(k) =(k-1-(n/2))/(n*ts);
y(k) = x(k)*((-1.0)^(k+1));
end;
fftx = fft(y)/n;
% End of function file.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?