DFT to do spectrum analysis and understand _DFT

Source: Internet
Author: User
Tags abs cos truncated
DfT again understand

2015.12.18

Before learning "signal and system", for the use of FFT () function analysis of discrete, continuous time signal spectrum out of the result has been a smattering of knowledge, this semester learned "digital signal processing", learning the discrete Fourier transform (DFT), the previous written procedures to do further understanding.

Before this, the CTFs, Dtfs, Ctft, DTFT formulas are listed to facilitate understanding:


Note: Here the formula for calculating the Fourier coefficients of discrete periodic signals is one less than N, which is also covered below.

(i) DFT analysis of discrete aperiodic signal spectrum (discrete aperiodic dtft for continuous cycle, with 2*PI as the cycle)

Comparing DTFT and DFT formulas can be found:


N-Point DfT is a dtft result in the [0,2*PI] cycle of n-point sampling;

Therefore, the idea of analyzing the spectrum of discrete aperiodic signals is as follows:

(1) truncation of known signals (if they are limited in length);

(2) to intercept the discrete signal to do N-point DFT (where the n should be greater than the number of discrete signals, n larger, in the frequency domain of the more dense sampling);

(3) The horizontal axis is converted to "-pi,pi", which accords with the actual situation (/N*2*PI).

The specific explanation is shown in the following code (the concrete code is pasted on the last side).

Here is an example:


The results of the operation are as follows:


(ii) The spectrum of discrete periodic signals is analyzed by DFT (Dtfs of discrete periodic signals are discrete cycles, with the fundamental period n as the cycle)

Comparing Dtfs and DFT formulas, you can find:


As mentioned above, the DTFS formula above is n times the actual difference, so it needs to be taken into account when drawing the spectrum.

The fundamental period of the discrete periodic signal is n, and the N-point DFT is the value of a n-cycle of the discrete periodic signal dtfs.

Therefore, the idea of analyzing the spectrum of discrete periodic signals is as follows:

(1) Determining the fundamental period N;

(2) Taking N points of discrete periodic signals, such as "0,n-1";

(3) Do N-point DFT (amplitude to divide by N, the reason in the DTFS formula than the DFT formula before a more than a 1/n);

(4) The Fourier coefficients of discrete periodic signals in a fundamental wave period are obtained;

Here is an example:

(iii) Analysis of the frequency spectrum of continuous aperiodic signals using DFT (continuous aperiodic signals are CTFT for continuous cycles)

Using sampling, the continuous aperiodic signal is converted to discrete aperiodic signal, and the discrete aperiodic signal is DFT, similar to (a), and finally, the relationship between the analog frequency and the digital frequency (analog frequency multiplied by the sampling period equals the digital frequency) is used to convert the horizontal axis from the digital frequency to the analog frequency:


The idea of analyzing the spectrum of continuous aperiodic signals is as follows:

(1) truncated according to need (if the continuous signal is infinitely long);

(2) Estimating the maximum frequency of the signal FM;

(3) Sampling frequency fs>2*fm;

(4) The continuous signal is sampled by T (T=1/FS);

(5) Do N-point DFT for sampled signals (equivalent to discrete aperiodic signals) (where n should be greater than or equal to the number of sampled points, and the bigger the better, the greater the Representation (i) analysis, the more dense the sampling in frequency domain, the better approximation of discrete aperiodic signal spectrum, the DFT result amplitude is divided by T, This is the result of the sampling;

(6) Convert the horizontal axis to the analog frequency (/N*2*PI*FS).

Here is an example:


(iv) Analysis of the spectrum of continuous periodic signals using DFT (CTFs of continuous periodic signals as discrete aperiodic)

The continuous periodic signal is sampled in one or more fundamental period lengths, sampling frequency FS>2*FM, for the sampling point to do equal length (assuming N) of the DFT (amplitude is divided by n, reason with (ii)), because of the use of sampling, so the same as (c) need to convert the digital frequency to analog frequency (/n*2* PI*FS).

The idea of analyzing the spectrum of continuous periodic signals is as follows:

(1) To determine the fundamental cycle to and the highest frequency FM, sampling frequency fs>2*fm;

(2) for a period of continuous periodic signal (can be multiple cycles) to the frequency of FS uniform sampling, sampling points for N;

(3) to the sampling point to do N-point DFT (Amplitude/n, the same reason (ii));

(4) Convert the horizontal axis to the analog frequency (/N*2*PI*FS).

Here is an example:






All code:

function test1

%%%%%%%% (1) discrete aperiodic%%%%%%%%%%%%% x = 0.8.^n (spectrum is a continuous period (period of 2*PI))

N = 31;%%%%% infinitely long signal should be truncated as needed first

n = 0:n-1;

x = 0.8.^n;

X = FFT (x,n);%%%%%% to the truncated discrete signal to do N-point DFT equivalent to doing N-point uniform sampling in the "0,2pi" range of the spectrum

Figure

Subplot (3,1,1);

Stem (n,x);

Subplot (3,1,2);

Plot ([-(N-1)/2: (N-1)/2],abs (Fftshift (X)); The horizontal axis of the spectrum map drawn here is the point of sampling the actual spectrum of discrete aperiodic signals in the [%%%%%%] interval.

Subplot (3,1,3);

Plot ([-(N-1)/2: (N-1)/2]./n*2*pi,abs (Fftshift (X))%%%%%% the horizontal axis of the spectrum is converted to a [-PI,PI] interval, which is the actual situation (the DTFT of discrete aperiodic signals is continuous cycle, With 2pi as the cycle)

%%%%%% (2) discrete period%%%%%%%%%%%%% x =cos (PI/8*N+PI/3) +0.5cos (7*PI*N/8);(spectrum for discrete periods (periodic base wave period N))

%%%%%%%% determines that the fundamental period of the signal is 16.

N = 16;

n = 0:n-1;

x = cos (PI/8*N+PI/3) +0.5*cos (7*PI*N/8);

X = FFT (x,n)/n;%%%%%% to the truncated discrete signal to do N-point DFT, the result is equivalent to the original periodic signal in the "0,n-1" of the Fourier coefficients, divided by N to express the DFT formula and discrete periodic signal Fourier series formula needs;

Figure

Subplot (3,1,1);

Stem (n,x);

Subplot (3,1,2);

Stem ([-n/2:n/2-1],abs (Fftshift (X))); The horizontal axis of the spectrum map plotted here is the CTFs of the discrete periodic signal (Fourier coefficients, taking N as the cycle), the change in [-n/2:n/2-1], that is, the harmonic frequency (the fundamental cycle n= 16 of the case)

Subplot (3,1,3);

Stem ([-n/2:n/2-1]./n*2*pi,abs (Fftshift (X))); The horizontal axis of the spectrogram plotted here is to multiply the number of harmonics above the base wave frequency 2*pi/n

%%%%%% (3) Continuous non-periodic%%%%%%%%%%%%% x = exp ( -1*t);(spectrum for continuous aperiodic)

%%%%%% takes x the highest frequency FM of 25, according to Nyquist theorem criteria, the sampling rate is 100>2*25

%%%%% here the signal is infinitely long, also need to be truncated, here go 6 seconds before

FS = 100;

Tp = 6;

T = 1/fs;

t = 0:T:TP;

x = exp ( -1*t);

n = 1024;%%%%%%% to the number of DFT, where the N as long as more than sampling points, the larger the more can be approximated

X = FFT (x,n) *t;%%%%%% where T is multiplied by the spectrum amplitude variation caused by continuous signal sampling.

Subplot (2,1,1);

Plot (t,x);

Subplot (2,1,2);

%%%%%% the horizontal axis of the spectrum map drawn here is [-n/2:n/2-1]* (2*pi/n) is the digital angular frequency of spectral analysis of sampled discrete aperiodic signals, which is multiplied by FS, which is divided by the sampling period T to obtain the simulated angular frequency.

Plot ([-n/2:n/2-1]* (2*pi/n) *fs,abs (Fftshift (X)));

%%%%%%% (4) Continuous cycle%%%%%%%%%%%%% x =cos (10*pi*t) +2*cos (18*pi*t);(spectrum is discrete aperiodic)

%%%%%%% because the fundamental frequency of x is 2*PI, the fundamental period tp is 1s, the highest harmonic is 9, the highest frequency is 9Hz

%%%%%%% The sampling frequency is determined by the Nyquist theorem sampling criterion fs=20>2*9

FS = 20;

T = 1/fs;

Tp = 1;

N = tp/t;

t = 0:t:tp-t;

x = cos (10*pi*t) +2*cos (18*pi*t);

X = FFT (x,n)/n;

Subplot (2,1,1);

Plot (t,x);

Subplot (2,1,2);

Stem ([-n/2:n/2-1]/n*fs,abs (Fftshift (X))); The horizontal axis of the spectrogram plotted here is [-n/2:n/2-1]* (2*pi/n) is the digital angular frequency obtained by spectral analysis of sampled discrete aperiodic signals, Multiply FS to divide the sampling period t to get the analog angular frequency

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.