0% found this document useful (0 votes)
59 views25 pages

W08 - D01 Computati212onal Methods in Physics

The document discusses Fourier analysis techniques. It begins by introducing Fourier series and how they can be used to represent periodic functions as sums of sinusoids. It then introduces the Fourier transform, which extends this idea to non-periodic functions by allowing the period to approach infinity. The Fourier transform decomposes a function into its constituent frequencies. The document also discusses the fast Fourier transform algorithm, which enables efficient computation of Fourier transforms, and provides examples of using Fourier analysis to approximate derivatives and for signal detection in applications like radar.

Uploaded by

Kenn Senados
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views25 pages

W08 - D01 Computati212onal Methods in Physics

The document discusses Fourier analysis techniques. It begins by introducing Fourier series and how they can be used to represent periodic functions as sums of sinusoids. It then introduces the Fourier transform, which extends this idea to non-periodic functions by allowing the period to approach infinity. The Fourier transform decomposes a function into its constituent frequencies. The document also discusses the fast Fourier transform algorithm, which enables efficient computation of Fourier transforms, and provides examples of using Fourier analysis to approximate derivatives and for signal detection in applications like radar.

Uploaded by

Kenn Senados
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

W08_D01 Computational Methods in Physics

Phys 168

Time Frequency Analysis


Fourier Transforms Wavelets

Fourier Series and Fourier Transform


From Dish to Recipe: from consumers PoV to Producers PoV
The Fourier Transform (FT) extracts each "cycle ingredient" from a time-based signal (i.e., the cycle strength, delay & speed), resulting in a final "cycle recipe

The FTs PoV: any signal can be made from circular motion or repeating cycles. Anything in the world can be described via a waveform - a function of time, space or some other variable.
Fourier introduced the concept of representing a given function by a trigonometric series of sines and cosines: For instance, sound waves, electromagnetic fields, radar detection systems, musical notes, TV signals, cell phone signals, etc

Example:

The motivation for the Fourier transform comes from the study of Fourier series. In the study of Fourier series, complicated but periodic functions are written as the sum of simple waves mathematically represented by sines and cosines. The Fourier transform is an extension of the Fourier series that results when the period of the represented function is lengthened and allowed to approach infinity.

Fourier Series
Fourier Series Representation of a function f(x): 0 = + 2

cos + sin () ; (, ]

At that time, this was still a shocking assertion! To solve for the coefficients and :
Assume for the moment f(x) is a uniformly convergent series Multiply both sides with cos(mx) or sin(mx) Integrate from (, ]

Fourier Series
To solve for the coefficients and :
0 = + 2

cos + sin () ; (, ]

0 cos = cos + 2

cos cos +

sin () cos

Fourier Series
To solve for the coefficients and :
0 = + 2

cos + sin () ; (, ]

0 cos = cos + 2 Integral=ZERO

cos cos +

sin () cos

Fourier Series
To solve for the coefficients and :
0 = + 2

cos + sin () ; (, ]

0 cos = cos + 2 Integral=ZERO

cos cos +

sin () cos

integral= Integral=0

if = if

Fourier Series
To solve for the coefficients and :
0 = + 2

cos + sin () ; (, ]

0 cos = cos + 2 Integral=ZERO

cos cos +

sin () cos

integral= Integral=0

if = if

Integral=ZERO orthogonality

Fourier Series
To solve for the coefficients and :
0 = + 2

cos + sin () ; (, ]

0 cos = cos + 2 Integral=ZERO Then rearranging we have:


cos cos +

sin () cos

integral= Integral=0

if = if
1

Integral=ZERO orthogonality

cos =

cos ; 0

Fourier Series
Now we have the coefficient :

cos = sin =

= =

1 1

cos ; 0 sin ; > 0

It also follows that [for the coefficient ]:

These are the Fourier Coefficients. This expansion produces 2periodic functions since they are constructed from sines and consines on the interval (, ].

Fourier Series
In general, the expansion produces the Fourier series on the domain [, ]:

/ =

; =

1 2

Fourier Transform
The Fourier transform (frequency domain representation) over the domain [, ] is defined as: 1 () = 2 Its inverse (time domain representation) is given as: 1 () = 2
This is known as Fourier Inversion Theorem, and was first introduced in Fourier's Analytical Theory of Heat. The functions f(x) and F(k) often are referred to as Fourier integral pair or Fourier transform pair We again note that formally, the transform is over the entire real line [, ] whereas our computational domain is only over a finite domain [, ]. Further, the Kernel of the transform, , describes oscillatory behavior. Thus the Fourier transform is essentially an eigenfunction expansion over all continuous wavenumbers k. And once we are on a finite domain [, ], the continuous eigenfunction expansion becomes a discrete sum of eigenfunctions and associated wavenumbers (eigenvalues).

Application: Derivative Approximation


Note our Transform : Assuming f(x)=0 as x goes to infinity: () = 1 2

= ()

hat represents the Fourier Transform In general, we have the relation between the Fourier Transform of the derivative and the Fourier Transform itself: = ()

Example: Derivative Approximation


Take for example this differential equation: 2 = [, ] Applying Fourier Transform to both sides: 2 = = ()2 2 2 = = 2 + 2 To find the solution y(x), we invert the expression above to yield: 1 () = 2 + 2 2
which can be solved numerically or analytically

What we want: Fast Fourier Transform (FFT)!!!


The Fourier transform (frequency domain representation) over the domain [, ] is defined as: 1 () = 2 Its inverse (time domain representation) is given as: 1 () = 2 Will use the Fast Fourier Transform (FFT) algorithm [developed in 1960s by Cooley and Tukey] Named one of the top 10 algorithms of the 20th century for ONE REASON: -the operation count for solving a system dropped to O(N log2N). [super FAST!!!] FFTs key features: 1. It has low operation O(N log2N) 2. It finds the transform on an interval [, ]. Since the integration Kernel exp(ikx) is oscillatory, it implies that the solutions on this finite interval have periodic boundary conditions 3. discretize the range into 2n points to lower the operation count (i.e., 2,4,8,16,32,64,128,526,) 4. FFT has excellent accuracy properties, well beyond that of standard discretization schemes.

Fast Fourier Transform (FFT)


Given a function which has been discretized with 2n points represented by a vector x. The FFT command is: () The command fft(x) will transform the function and it does THREE (3) MAJOR THINGS: 1. It SHIFTS the data so that 0, , 0 and , 0 [0, L] 2. It multiples every other mode by -1, 3. It ASSUMES you are working on a 2 periodic domain. Lets try: well transform a Gaussian function. = () = Let =1.
2

1 2 exp ( ) 2 4

Here is our code:


L=20; % define the computational domain [-L/2,L/2] n=128; % define the number of Fourier modes 2^n x2=linspace(-L/2, L/2, n+1); % define the domain discretization x=x2(1:n); % consider only the first n points: periodicity k = (2*pi/L) * [0:(n/2-1) (-n/2):-1]; % k rescaled to 2pi domain ks = fftshift(k); % shift of k domain u=exp(-x.^2) % function ut=fft(u); % FFT the function utshift=fftshift(ut); % shift FFT subplot(1,3,1), plot(x,u) % plot initial gaussian subplot(1,3,2), plot(abs(ut)) % plot unshifted transform (absolute) subplot(1,3,3), plot(ks,abs(utshift)) % plot shifted transform (absolute)

Here is our code:


The fftshift command shifts the transformed function back to tis mathematically correct positions. However, before inverting the transformation, it is CRUCIAL to shift back the

Example: Derivative
L=20; % define the computational domain [-L/2,L/2] n=128; % define the number of Fourier modes 2^n x2=linspace(-L/2, L/2, n+1); % define the domain discretization x=x2(1:n); % consider only the first n points: periodicity k = (2*pi/L) * [0:(n/2-1) (-n/2):-1]; % k rescaled to 2pi domain ks = fftshift(k); % shift of k domain

= ()

u=sech(x) % function to take a derivative of ud = -sech(x).*tanh(x); % analytical 1st-derivative of the function u2d = sech(x)-2*sech(x).^3; % analytical 2nd-derivative of the function

ut=fft(u); % FFT the function utd=(i*k).*ut; % Derivative of the FFT ut2d=(i*k).^2.*ut; % Derivative of the FFT for 2nd-derivative uds=ifft( utd ); % approximation (inverse-FT) of the 1st-derivative u2ds=ifft( ut2d ); % approximation (inverse-FT) of the 1st-derivative figure(1),plot(x,ud,'r', x,uds,'mo') % plot figure(2),plot(x,u2d,'r', x,u2ds,'mo') % plot

Application: Radar Detection


Lets consider an ideal signal: u=sech(t) Which is generated in the time-domain. OUR GOAL: is to find this signal from a noisy data.

Application: Radar Detection


clear all; close all; T=30; % time slot to transform n=512; % number of Fourier modes 29 t2=linspace(-T,T,n+1); t=t2(1:n); % time discretization k=(2*pi/(2*T))*[0:(n/2-1) -n/2:-1]; % frequency % components of FFT ks=fftshift(k); u=sech(t); % ideal signal in the time domain ut = fft(u); uts=fftshift(ut); subplot(2,1,1),plot(t,u,k) subplot(2,1,2),plot(ks,uts, k)

Application: Radar Detection


Now lets add noise in our ideal signal. And, well try to detect our ideal signal.
noise = 10; % WHITE NOISE in the freq-domain utn=ut + noise * ( randn(1,n) + i*randn(1,n) ); % noisy signal un = ifft(utn); subplot(3,1,1),plot(t,u,'k', t, abs(un), 'm') % normalized subplot(3,1,2),plot(ks,abs(uts/max(uts)), 'k', ... ks, abs(fftshift(utn)/max(fftshift(utn))), 'm') % plot FT-pair, ideal axis([-25 25 0 1]);

Application: Radar Detection


Now well detect our ideal signal: Spectral Filtering: allows us to extract information at specific frequencies. In our case, the emitted signal freq is of interest at the detector and filter out those other freq components. One of the simplest filter: Gaussian Filter = exp ( 0 2 ) Where measures the bandwidth of the filter, and k is wave number. In our case, this filter acts as a low-pass filter (eliminates high-freq components in the system) Note that these are high frequencies in relation to the center-frequency (k = k0) of the desired signal field. In the example considered here k0 = 0. Application of the filter attenuates strongly those frequencies away from center frequency k0. Thus if there is a signal near k0, the filter isolates the signal input around this frequency or wavenumber.

Application: Radar Detection


Now well detect our ideal signal.
noise = 10; % WHITE NOISE : noise that affects all freq the same. utn=ut + noise * ( randn(1,n) + i*randn(1,n) ); % noisy signal un = ifft(utn); filter = exp(-k.^2); % our filter utnf=filter .* utn; unf = ifft(utnf); subplot(2,1,1),plot(t,u,'k', t, abs(un), 'm', t, abs(unf),'g, t, 0.*t+0.5, k) % normalized subplot(2,1,2),plot(ks,abs(uts/max(uts)), 'k', ks, abs(fftshift(utn)/max(fftshift(utn))), 'm', ... ks, fftshift(filter), 'b', ks, abs(fftshift(utnf)/max(fftshift(utnf))), 'g')

You might also like