+ All Categories
Home > Documents > Section 10 Fourier Analysis - Oregon State...

Section 10 Fourier Analysis - Oregon State...

Date post: 27-Jan-2021
Category:
Upload: others
View: 4 times
Download: 2 times
Share this document with a friend
80
MAE 4020/5020 – Numerical Methods with MATLAB SECTION 10: FOURIER ANALYSIS
Transcript
  • MAE 4020/5020 – Numerical Methods with MATLAB

    SECTION 10: FOURIER ANALYSIS

  • Fourier Series – Trigonometric Form2

    K. Webb  MAE 4020/5020

  • 3

    Periodic Functions

    K. Webb  MAE 4020/5020

    A function is periodic if

    where  is the period of the function

    The function repeats itself every  seconds Here, we’re assuming a function of time, but could also be a spatial function, e.g. Elevation Pixel intensity along rows or columns of an image

  • 4

    Frequency

    K. Webb  MAE 4020/5020

    The frequency of a periodic function is the inverse of its period

    1

    We’ll refer to a function’s frequency as its fundamental frequency, 

    This is ordinary frequency, and has units of Hertz (Hz) (or cycles/sec)

    Can also describe a function in terms of its angularfrequency, which has units of rad/sec

    2 ⋅2

  • 5

    Fourier Series

    K. Webb  MAE 4020/5020

    In other words, any periodic signal of engineering interest

    Then it can be represented as an infinite sum of harmonically‐related sinusoids, the Fourier series

    Fourier discovered that if a periodic function satisfies the Dirichlet conditions:1) It is absolutely integrable over any period:

    2) It has a finite number of maxima and minima over any period

    3) It has a finite number of discontinuities over any period

    Joseph Fourier1768 – 1830 

  • 6

    Fourier Series

    K. Webb  MAE 4020/5020

    The Fourier series

    cos sin

    where  is the fundamental frequency,  

    and, the Fourier coefficients are given by

    1

    the average value of the function over a full period, and

    2cos , 1,2,3…

    and2

    sin , 1,2,3…

  • 7

    Sinusoids as Basis Functions

    K. Webb  MAE 4020/5020

    Harmonically‐related sinusoids form a set of orthogonal basis functions for any periodic functions satisfying the Dirichlet conditions

    Not unlike the unit vectors in  space:

    ̂ 1,0 , ̂ 0,1

    Any vector can be expressed as a linear combination of these basis vectors

    ̂ ̂

    where each coefficient is given by an inner product

    ⋅ ̂⋅ ̂

    These are the projections of  onto the basis vectors

  • 8

    Sinusoids as Basis Functions

    K. Webb  MAE 4020/5020

    Similarly, any periodic function can be represented as a sum of projections onto the sinusoidal basis functions

    Similar to vector dot products, these projections are also given by inner products: 

    2cos , 1,2,3…

    and2

    sin , 1,2,3…

    These are projections of  onto the sinusoidal basis functions

  • 9

    Fourier Series – Example 

    K. Webb  MAE 4020/5020

    Consider a rectangular pulse train

    2

    0.5

    Can determine the Fourier series by integrating over any full period, for example, 

  • 10

    Fourier Series – Example –

    K. Webb  MAE 4020/5020

    10 0.500.5 1.511.5 2.0

    First, calculate the average value

    1 12

    12 1

    . 12 0

    .

    .

    12 1.

    12

    . 12 .

    0.25 0.25

    0.5,  as would be expected

  • 11

    Fourier Series – Example –

    K. Webb  MAE 4020/5020

    Next determine the cosine coefficients, 

    2cos

    22 cos

    . 22 cos.

    1sin

    . 1sin

    .

    1sin 2 0 0 sin 3 2

    1sin 2 sin 3 2

  • 12

    Fourier Series – Example –

    K. Webb  MAE 4020/5020

    We know that

    sin 3 2 sin 2 sin 2so

    2sin 2 , 1,2,3…

    The first few values of  :

    , 0 , , 0 ,

    Zero for all even values of  Only odd harmonics present in the Fourier Series

  • 13

    Fourier Series – Example –

    K. Webb  MAE 4020/5020

    Next, determine the sine coefficients, 

    2sin

    22 sin

    . 22 sin.

    1cos

    .cos

    .

    1cos 2 1 1 cos 2 0

    0, 1,2,3…

    All  coefficients are zero Only cosine terms in the Fourier series

  • 14

    Fourier Series – Example

    K. Webb  MAE 4020/5020

    The Fourier series for the rectangular pulse train:

    0.52sin 2 cos

    Note that this is an equality as long as we include an infinite number of harmonics

    Can approximate  by truncating after a finite number of terms

  • 15

    Fourier Series – Example

    K. Webb  MAE 4020/5020

  • 16

    Fourier Series – Example

    K. Webb  MAE 4020/5020

  • 17

    Even and Odd Symmetry 

    K. Webb  MAE 4020/5020

    An even function is one for which

    An odd function is one for which

    Consider two functions,  and  If both are even (or odd), then

    2

    If one is even, and one is odd, then

    0

  • 18

    Even and Odd Symmetry 

    K. Webb  MAE 4020/5020

    Since  is even, and  is odd If  is an even function, then

    4cos

    /, 1, 2, 3, …

    0, 1, 2, 3, …

    If  is an odd function, then0, 1, 2, 3, …

    4sin

    /, 1, 2, 3, …

    Recall the Fourier series for the pulse train, an even function, had only cosine terms

  • Fourier Series – Cosine w/ Phase Form19

    K. Webb  MAE 4020/5020

  • 20

    Cosine‐with‐Phase Form

    K. Webb  MAE 4020/5020

    Given the trigonometric identity

    cos sin cos

    where         and      tan

    We can express the Fourier series in cosine‐with‐phase form: 

    cos

    where 

    tan , 0

    tan , 0

  • 21

    Cosine‐with‐Phase Form – Example 

    K. Webb  MAE 4020/5020

    Consider, again, the rectangular pulse train

    sin

    0

    So,

    2sin 2

    and 

    tan0

    2 sin 2

    0, 1, 5, 9, …, 3, 7, 11, …

  • 22

    Line Spectra

    K. Webb  MAE 4020/5020

    The cosine‐with‐phase form of the Fourier series is conducive to graphical display as amplitude and phase line spectra

    Average value and amplitude of odd harmonics are clearly visible

  • Fourier Series – Complex Exponential Form23

    K. Webb  MAE 4020/5020

  • 24

    Complex Exponential Fourier Series

    K. Webb  MAE 4020/5020

    Recall Euler’s formula

    cos sin

    This allows us to express the Fourier series in a more compact, though equivalent form

    where the complex coefficients are given by

    1

    Note that the series is now computed for both positive and negative harmonics of the fundamental

  • 25

    Complex Exponential Fourier Series

    K. Webb  MAE 4020/5020

    We can express the complex series coefficients in terms of the trigonometric series coefficients

    12 , 1, 2, 3, …

    12 , 1, 2, 3, …

    Coefficients at  are complex conjugates, so

    and     ∠ ∠

  • 26

    Complex Exponential Fourier Series

    K. Webb  MAE 4020/5020

    Similarly, the coefficients of the trigonometric series in terms of the complex coefficients are

    2

    2

    Can also relate the complex coefficients to the cosine‐with‐phase series coefficients

    12 , 1, 2, 3, …

    ∠ , 1, 2, 3, …, 1, 2, 3, …

  • 27

    Even and Odd Symmetry

    K. Webb  MAE 4020/5020

    For even functions, since  0, coefficients of the complex series are purely real:

    12 , 1, 2, 3, …

    For odd functions, since  0, coefficients of the complex series are purely imaginary (except  ):

    12 , 1, 2, 3, …

    12 , 1, 2, 3, …

  • 28

    Complex Series – Example 

    K. Webb  MAE 4020/5020

    10 0.500.5 1.511.5 2.0

    The complex Fourier series for the rectangular pulse train:

    The complex coefficients are given by1 /

    /

    12

    12

    .

    .

    12 .

    .

  • 29

    Complex Series – Example 

    K. Webb  MAE 4020/5020

    12 .

    .

    12

    Rearranging into the form of a sinusoid

    12

    1sin 2

    Given the even symmetry of  , all coefficients are real, and also have even symmetry 

    1sin 2

    1, 0,

    13 , 0,

    15 , 0, …

  • 30

    Line Spectra

    K. Webb  MAE 4020/5020

    The complex series coefficients can also be plotted as amplitude and phase line spectra Now, plot spectra over positive and negative frequencies

    Note that the magnitude spectrum is an even function of frequency, and the phase spectrum is an odd function of frequency

  • The Fourier series can also be understood by approaching it as a least‐squares curve‐fitting problem, where sinusoids are fit to a function or data set.

    Sinusoidal Curve Fitting31

    K. Webb  MAE 4020/5020

  • 32

    Sinusoidal Curve Fitting

    K. Webb  MAE 4020/5020

    In a previous section of the course we saw how we can fit different functions to data using linear least‐squares regression Can also fit sinusoids using this technique

    The data we’re fitting could be:Measured data that we believe to be sinusoidal in nature

    A periodic function, that, while not sinusoidal, we want to approximate as a sinusoid or sum of sinusoids

  • 33

    Sinusoidal Curve Fitting

    K. Webb  MAE 4020/5020

    Our fitting function is

    cos

    The fundamental frequency is

    22

    where  is the period of the function or data we are fitting

    The three fitting parameters are:  ,  , and  In order to be able to apply linear regression, we can’t have a fitting 

    parameter in the argument of a trigonometric function Apply a trig. Identity to recast the model as

    cos sin

    Assuming we know  , this is a linear least‐squares model

  • 34

    Sinusoidal Curve Fitting

    K. Webb  MAE 4020/5020

    Assuming  is known, the linear least‐squares model is

    where1,    cos ,    sin

    and ,    ,   and   

    For a least‐squares fit, minimize the sum of the squares of the residuals

    cos sin

  • 35

    Normal Equations

    K. Webb  MAE 4020/5020

    As we saw in the curve fitting section of the course, the matrix normal equations for this least‐squares fit are

    where  is the design matrix:

    ⋮ ⋮ ⋮

    1 cos sin1 cos sin⋮ ⋮ ⋮1 cos sin

    is the vector of fitting parameters

    and  is the vector of  function or data values

  • 36

    Normal Equations –

    K. Webb  MAE 4020/5020

    The LHS of the normal equations is

    1 1 ⋯ 1cos cos ⋯ cossin sin ⋯ sin

    1 cos sin1 cos sin⋮ ⋮ ⋮1 cos sin

    Σ cos Σ sinΣ cos Σ cos Σ cos sinΣ sin Σ sin cos Σ sin

    If we assume our  data points span exactly one period, then we know the following mean values

    Σ cos Σ sin Σ cos sin0

    andΣ cos Σ sin 1

    2

  • 37

    Normal Equations –

    K. Webb  MAE 4020/5020

    Using these known mean values, the normal equations simplify to

    0 00 /2 00 0 /2

    ΣΣ cosΣ sin

    We can solve for the vector of fitting parameters, 

    The inverse of the diagonal matrix is a diagonal matrix, where the diagonal elements are inverted, so

    1/ 0 00 2/ 00 0 2/

    ΣΣ cosΣ sin

  • 38

    Sinusoidal Least‐Squares Fit

    K. Webb  MAE 4020/5020

    The fitting parameters areΣ

    2Σ cos

    2Σ sin

    Note the similarity to the Fourier series coefficients

    The least‐squares, best‐fit sinusoid is given byΣ 2

    Σ cos cos2Σ sin sin

  • 39

    Sinusoidal Least‐Squares Fit – Example 

    K. Webb  MAE 4020/5020

    As expected,  0 due to the  even symmetry of the function being fit

  • 40

    Least‐Squares Fit of Two Harmonics

    K. Webb  MAE 4020/5020

    Now, consider extending the fitting model to include the first two harmonics

    cos sin cos 2 sin 2

    We’ve added two more basis functions to the linear least‐squares model

    The design matrix is now1 cos sin cos 2 sin 21 cos sin cos 2 sin 2⋮ ⋮ ⋮ ⋮ ⋮1 cos sin cos 2 sin 2

  • 41

    Least‐Squares Fit of Two Harmonics

    K. Webb  MAE 4020/5020

    If we again assume samples spanning exactly one period, the off‐diagonal terms on the LHS of the normal equations go to zero, leaving

    0 0 0 00 /2 0 0 00 0 /2 0 00 0 0 /2 00 0 0 0 /2

    ΣΣycosΣysinΣycos 2Σysin 2

    Solve for  as

  • 42

    Least‐Squares Fit of Two Harmonics

    K. Webb  MAE 4020/5020

    Solving for  gives the following fitting parametersΣ

    2Σ cos

    2Σ sin

    2Σ cos 2

    2Σ sin 2

    This model could obviously be extended to include an arbitrary number of harmonics

  • 43

    Least‐Squares Fit – Example 

    K. Webb  MAE 4020/5020

    Sawtooth wave has odd symmetry, so B 0, and only sine terms are present

  • The Fourier transform extends the frequency‐domain analysis capability provided by the Fourier series to aperiodic signals.

    Fourier Transform44

    K. Webb  MAE 4020/5020

  • 45

    Fourier Transform

    K. Webb  MAE 4020/5020

    The Fourier Series is a tool that provides insight into the frequency content of periodic signals

    where the complex coefficients are given by /

    /

    These  values provide a measure of the energy present in a signal at discrete values of frequency , integer multiples (harmonics) of the fundamental 

    Frequency‐domain representation is discrete, because the time‐domain signal is periodic

  • 46

    Fourier Transform

    K. Webb  MAE 4020/5020

    Many signals of interest are aperiodic They never repeat Equivalent to an infinite period,  → ∞

    As  , the mapping from the time domain to the frequency domain is given by the Fourier transform

    where  is a complex, continuous function of frequency

    The continuous frequency‐domain representation corresponds to the aperiodic time‐domain signal

  • 47

    Inverse Fourier Transform

    K. Webb  MAE 4020/5020

    We can also map frequency‐domain functions back to the time domain using the inverse Fourier transform

    12

    The forward ( or  transform) and the inverse ( or  transform) provide the mapping between Fourier transform pairs

  • 48

    Fourier Transform – Rectangular Pulse 

    K. Webb  MAE 4020/5020

    Consider a pulse of duration, 

    Calculate the Fourier transform

    /

    /

    1 1

    22

    2sin 2

  • 49

    Fourier Transform – Rectangular Pulse 

    K. Webb  MAE 4020/5020

    Here, we can introduce the sinc function

    sin

    Letting  , we have

    2sin 2

    sin 2

    2

    2

  • 50

    Fourier Transform – Triangular Pulse 

    K. Webb  MAE 4020/5020

    Next, consider a triangular pulse of duration, 

    Λ

    Λ

    2

    1, 2 02

    1, 0 20, otherwise

    The Fourier transform is

    Λ2

    1/

    21

    /

    Integrating by parts, or symbolically in MATLAB, gives

    8sin 4

  • 51

    Fourier Transform – Triangular Pulse 

    K. Webb  MAE 4020/5020

    This, too, can be recast into the form of a sincfunction

    Letting  , we have

    8sin 4

    2sin 4

    4

    2 4

  • 52

    Rectangular vs. Triangular Pulse 

    K. Webb  MAE 4020/5020

    Average value in time domain translates to  0 value in frequency domain

    More abrupt transitions in time domain correspond to more high‐frequency content 

    Multiplication in one domain corresponds to convolution in the other

    Convolution of two rectangular pulses is a triangular pulse

    becomes  in the frequency domain

  • 53

    Fourier Transform – Impulse Function

    K. Webb  MAE 4020/5020

    The impulse function is defined as

    0, 0

    1

    Its Fourier transform is

    Since  0 for  0, and since  1 for  0

    1

    The Fourier transform of the time‐domain impulse function is one for all frequencies Equal energy at all frequencies

  • 54

    Fourier Transform – Decaying Exponential

    K. Webb  MAE 4020/5020

    Consider a decaying exponential

    ⋅ 1

    where 1 is the unit step function

    The Fourier transform is:

    1 10 1

    1

  • 55

    Fourier Transform – Decaying Exponential

    K. Webb  MAE 4020/5020

    Fourier transform of this exponential signal is complex

    Plot magnitude and phase separately

    Note the even symmetry of magnitude, and odd symmetry of the phase of 

  • 56

    Fourier Transform – Decaying Exponential

    K. Webb  MAE 4020/5020

    On logarithmic scales, this Fourier transform should look familiar

    could be the impulse response of a first‐order system Convolution of an impulse 

    with the system’s impulse response

    looks like the frequency response of a first‐order system Multiplication of the F.T. of an 

    impulse ( 1) with the system’s frequency response

  • 57

    Even and Odd Symmetry

    K. Webb  MAE 4020/5020

    We are mostly concerned with real time‐domain signals Not true for all engineering disciplines, e.g. communications, signal processing, etc.

    For a real time‐domain signal,  ,  If  is even  will be real and even If  is odd,  will be imaginary and odd If  has neither even nor odd symmetry,   will be complex with an even real part and an odd imaginary part.

  • For discrete‐time signals, mapping from the time domain to the frequency domain is accomplished with the discrete Fourier transform (DFT).

    Discrete Fourier Transform58

    K. Webb  MAE 4020/5020

  • 59

    Discrete‐Time Fourier Transform (DTFT)

    K. Webb  MAE 4020/5020

    The Fourier transform maps a continuous‐time signal, defined for ∞ ∞, to a continuous frequency‐domain function defined 

    for  ∞ ∞ In practice we have to deal with discrete‐time, i.e. sampled, signals

    Only defined at discrete sampling instants

    Now, mapping to the frequency domain is the discrete‐time Fourier transform (DTFT)

    DTFT maps a discrete, aperiodic, time‐domain signal to a continuous, periodic function of frequency 

  • 60

    Aliasing

    K. Webb  MAE 4020/5020

    Aliasing is a phenomena that results in a signal appearing as a lower‐frequency signal as a result of sampling

    In order to avoid aliasing, the sample rate must be at least the Nyquist rate

    2

    where  is the highest frequency component present in the signal

    For a given sample rate, the Nyquist frequency is the highest frequency signal that will not result in aliasing

    2

  • 61

    Aliasing – Examples 

    K. Webb  MAE 4020/5020

  • 62

    Discrete‐Time Fourier Transform (DTFT)

    K. Webb  MAE 4020/5020

    Discrete‐time  generated from  by sampling at a sample rate of  , with a  sample period of 

    Sampled signals can only accurately represent frequencies up to the Nyquist frequency

    2

    Higher frequency components of  are aliased down to lower frequencies in the range of 

    2 2

    The DTFT is a periodic function of frequency, with a period  Due to aliasing, sampling in the time domain corresponds to periodicity in the 

    frequency domain

  • 63

    The Discrete Fourier Transform (DFT)

    K. Webb  MAE 4020/5020

    The DTFT

    utilizes discrete‐time, sampled, data, but still requires and infinite amount of data

    In practice, our time‐domain data sets are both discrete and finite The discrete Fourier transform, DFT, maps discrete and finite

    (periodic) time‐domain signals to periodic and discrete frequency‐domain signals

  • 64

    The Discrete Fourier Transform (DFT)

    K. Webb  MAE 4020/5020

    Consider  samples of a time‐domain signal,  Sampled with sampling period  and sampling frequency  Total time span of the sampled data is  ⋅

    The DFT of  is

    /

    A discrete function of the integer value,  The DFT consists of  complex values:  , , … , Each value of  represents a discrete value of frequency from 

    0 to  

  • 65

    The Inverse Discrete Fourier Transform

    K. Webb  MAE 4020/5020

    A discrete, finite set of frequency‐domain data can be transformed back to the time domain

    The inverse discrete Fourier Transform (IDFT)

    1 /

    Note the  scaling factor In practice, this is often applied when computing the DFT Must exist in either the DFT or IDFT, not both

  • 66

    DFT Frequencies

    K. Webb  MAE 4020/5020

    /

    A dot product of  with a complex exponential

    The frequency of the exponential is  Ω, integer multiples of the normalized frequency, Ω

    Ω 2 /

    which has units of  / Normalized frequency is related to the ordinary frequency by the 

    sample rate, 

    Ω2

  • 67

    DFT Frequencies

    K. Webb  MAE 4020/5020

    /

    # of samples:  ,  sample rate:  ,  sample period:  Maximum detectable frequency

    /2 Nyquist frequency Corresponds to  /2, Ω

    Frequency increment (bin width, resolution)

    Δ1⋅

    Last  ⁄ 1 points of  ,  ⁄ … correspond to negative frequency

    2 Δ … Δ

  • 68

    DFT Frequencies

    K. Webb  MAE 4020/5020

    For example, consider  10 samples of a signal sampled at  100 ,  10

    Δ⋅ .

    10

    50

    ΔΩ ⁄ 0.2 ⁄

    Units

    Ω . . . . . . . . /

    / . . . . . . . . .

  • 69

    DFT ‐ Example

    K. Webb  MAE 4020/5020

    Consider the following signal0.3 0.5 cos 2 ⋅ 50 ⋅ cos 2 ⋅ 120 ⋅ 0.8 cos 2 ⋅ 320 ⋅

    Sample rate:  1 Record length:  100 Bin width: Δ 10

  • 70

    DFT ‐ Example

    K. Webb  MAE 4020/5020

    Plotting magnitude of (real) 

    Components at 0, 50, 120, and 310 are clearly visible

    Plot spectrum as a function of Index value,  Normalized frequency Ordinary frequency

    values divided by  so that is the average value of 

    Amplitude of other components given by the sum of  and magnitudes

    0.3 0.5 cos 2 ⋅ 50 ⋅ cos 2 ⋅ 120 ⋅ 0.8 cos 2 ⋅ 320 ⋅

  • 71

    Spectral Leakage

    K. Webb  MAE 4020/5020

    0.3 0.5 cos 2 ⋅ 50 ⋅ cos 2 ⋅ 120 ⋅ 0.8 cos 2 ⋅ 320 ⋅

    For  1 and  100, Δ 10 , and  all signal components fall at integer multiples of Δ All components lie in exactly one frequency bin

    Now, increase the number of samples to  105 Bin width decreases to Δ 9.52 Each non‐zero signal component now falls between frequency bins – Spectral 

    Leakage

  • 72

    Spectral Leakage

    K. Webb  MAE 4020/5020

    Signal components now fall between two bins

    Why non‐zero  over more than two bins? Truncation (windowing)

    Finite record length is equivalent to multiplication of  by a rectangular pulse (window) F.T. of pulse is a sinc Multiplication in the time domain →

    convolution in frequency domain

    Truncated signal is assumed periodic True only if windowing function 

    captures an integer number of periods of all signal components

  • 73

    Summary of Fourier Analysis Tools

    K. Webb  MAE 4020/5020

    Time Domain Frequency Domain

    Fourier series continuousperiodic (or truncated)

    aperiodicdiscrete

    Fourier transform

    continuousaperiodic 

    aperiodiccontinuous

    DTFT discreteaperiodic

    periodiccontinuous

    DFT discreteperiodic (or truncated)

    periodicdiscrete

    In general:Frequency DomainDiscreteContinuousAperiodicPeriodic

    Time DomainPeriodic 

    AperiodicContinuous

    Discrete

  • DFT Algorithm74

    K. Webb  MAE 4020/5020

  • 75

    Implementing the DFT in MATLAB

    K. Webb  MAE 4020/5020

    /

    A dot product of complex ‐vectors for each of the values of 

    ⋅ /

    Simple to code multiplications for each 

    value – operations Inefficient, particularly for large 

  • 76

    Fast Fourier Transform – FFT 

    K. Webb  MAE 4020/5020

    The fast Fourier transform (FFT) is a very efficient algorithm for computing the DFT The Cooley‐Tukey algorithm

    Requires on the order of  operations  Significantly fewer than 

    For example, for  :  DFT:  operations FFT:  operations – ( faster)

    Requires  be a power of two If not, data record is padded with zeros

  • It is very simple to implement a straight DFT algorithm in MATLAB, but the FFT algorithm is, by far, more efficient .

    FFT in MATLAB77

    K. Webb  MAE 4020/5020

  • 78

    Fast Fourier Transform in MATLAB – fft.m

    K. Webb  MAE 4020/5020

    Xk = fft(x,n)

    x: vector of points for DFT computation n: optional length of the DFT to compute Xk: complex vector of DFT values – size(x) or an n‐vector

    If n is not specified, x will either be truncated or zero‐padded so that its length is n

    If x is a matrix, the fft for each column of x is returned

    fft.m uses the Cooley‐Tukey algorithm

    Fastest for length(x) or n that are powers of two

  • 79

    Inverse FFT in MATLAB – ifft.m

    K. Webb  MAE 4020/5020

    x = ifft(Xk,n)

    Xk: vector of points for inverse DFT computation n: optional length of the inverse DFT to compute x: complex vector of time‐domain values – size(x) or an n‐vector

    If n is not specified, x will either be truncated or zero‐padded so that its length is n

    If Xk is a matrix, the inverse fft for each column of Xk is returned

    ifft.m uses the Cooley‐Tukey algorithm Fastest for length(Xk) or n that are powers of two

  • 80

    Shifting Negative Frequency Values – fftshift.m

    K. Webb  MAE 4020/5020

    Xshift = fft(Xk)

    Xk: vector of FFT values with zero frequency point at Xk(1) Xshift: FFT vector with the zero‐frequency point moved to the middle of 

    the vector

    If N = length(Xk) is even, first and second halves of Xk are swapped Xshift = [Xk(N/2+1:N),Xk(1:N/2)]

    Frequency points are:  … Δ

    If N = length(Xk) is odd, zero frequency point moved to the Xshift((N+1)/2) position Xshift = [Xk((N+3)/2):N),Xk(1:(N-1)/2)]

    Frequency points are:  …


Recommended