Discrete Fourier Transform and Its Applications

        The discrete Fourier transform is a transformation in which the Fourier transform presents a discrete form in both the time domain and the frequency domain. The discrete-time Fourier transform (DTFT) discretizes the original signal in the time domain, which is a continuous function of frequency, and DFT discretizes the DTFT in the frequency domain. DFT is a Fourier transform for finite length sequences . DFT itself is also a sequence and has periodicity. The sequences in the time domain and frequency domain are of finite length.

1. The definition of DFT:

When 0 ≤ n ≤ N-1, the N -point discrete Fourier transform (DFT) of the finite length sequence x[n] is,

Including

         The discrete Fourier transform X[k] of a discrete time series x[n] of length N is equal to its discrete time Fourier transform X(e^{jw}),

 Frequency samples to be found at N evenly spaced frequency points  . Right now

 2. Discrete Fourier transform and inverse discrete Fourier transform in MATLAB

% 离散傅里叶变换和离散傅里叶逆变换的计算
% Computation of DFT and IDFT
clear;clc;close all
x=[1 2 3 4 5 6 7 8];      % discrete-time sequence
L=length(x);  
N=L;      % set samples number in frequency domain
% 当采样小于 L 时会发生混叠
w=2*pi/N*(0:N-1);    %  discrete frequency
Xw=zeros(1,N);  % vector for storing DFT 
for k=1:N     
     Xw(k)=x*(exp(-j*w(k)*(0:L-1)'));   % DFT
end 
y=zeros(1,N);
for n=1:N
y(n)=(1/N)*Xw* (exp(j*(n-1)*w'));   % IDFT
end
y=real(y);

A function of DFT and IDFT can be written through the above operation process:

function [X] = dft(x,L)
% 对一个离散序列进行DFT
% x为序列长度为 L 的离散时间序列,X为DFT结果
N=L;      % set samples number in frequency domain
w=2*pi/N*(0:N-1);    %  discrete frequency
X=zeros(1,N);  % vector for storing DFT 
for k=1:N     
     X(k)=x*(exp(-i*w(k)*(0:L-1)'));   % DFT
end 
end
function [x] = idft(X,L)
% 对一个离散序列进行 IDFT
% X为序列长度为 L 的DFT序列,x为IDFT结果
N=L;      % set samples number in frequency domain
w=2*pi/N*(0:N-1);    %  discrete frequency
x=zeros(1,N);
for n=1:N
x(n)=(1/N)*X* (exp(j*(n-1)*w'));   % IDFT
end
end

Guess you like

Origin blog.csdn.net/weixin_58351753/article/details/128207555