dft.m
来自「matlab算法集 matlab算法集」· M 代码 · 共 30 行
M
30 行
function y = dft (x,dir)
%----------------------------------------------------------------
% Usage: y = dft (x,dir)
%
% Description: Compute the one-dimensional discrete Fourier
% transform (DFT) or its inverse. When the number
% of points is a power of 2, use the efficient
% fast Fourier transform (FFT) technique.
%
% Inputs: x = n by 1 complex vector containing samples
% to be transformed.
% dir = direction code. If dir >= 0, compute
% the forward DFT of x, otherwise compute
% the inverse DFT of x.
%
% Outputs: y = n by 1 vector containing transformed samples.
%
% Note: For definitions of DFT and inverse DFT, type
% help fft.
%----------------------------------------------------------------
chkvec (x,1,'dft');
if dir >= 0
y = fft (x);
else
y = ifft (x);
end
%----------------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?