ESSE 4020 / ESS 5020 Time Series and Spectral Analysis Nov ... · ESSE 4020 / ESS 5020 Time Series...

Post on 04-May-2018

251 views 4 download

Transcript of ESSE 4020 / ESS 5020 Time Series and Spectral Analysis Nov ... · ESSE 4020 / ESS 5020 Time Series...

ESSE 4020 / ESS 5020 Time Series and Spectral AnalysisNov 21 2016

EXAM INFO

Sun, 11 Dec 2016 19:00-22:00DB 0014 - Victor Phillip Dahdaleh Building (DB) - TEL building

Fourier series and Spectral Analysis,

B&D, Chapter 4 + https://en.wikipedia.org/wiki/Fourier_transformhttps://en.wikipedia.org/wiki/Fast_Fourier_transformhttp://www.fing.edu.uy/if/cursos/fiscomp/extras/numrec/book/f12.pdf

Spectral Densities (B&D)

Note the factor 2π. Wavenumber (s-1) or frequency (Hz). eikλ or e2πihλ

1

Basic Fourier Transform and Inverse

https://en.wikipedia.org/wiki/Euler%27s_formula

Euler's formula, named after Leonhard Euler, is a mathematical formula in complex analysis that establishes the fundamental relationship between the trigonometric functions and the complex exponential function. Euler's formula states that, for any real number x:

e i x = cos x + i sin x

where e is the base of the natural logarithm, i is the imaginary unit, and cos and sin are the trigonometric functions cosine and sine respectively, with the argument x given in radians.

Various proofs, e.g. using power serieseiπ = ? An interesting link.

2

Basic Fourier Transform pair, f in Hz, note the extra 2π in exponentials, ω = 2πf is angular frequency radians/sec, s-1.(12.0.1)

h(t) could be complex, but we will use real examples, H may be complex but,

From: http://www.fing.edu.uy/if/cursos/fiscomp/extras/numrec/book/f12.pdf

3

Note: ↔ with double bars indicates FT pair.

Assume N is even and hN = h0 (periodic)

4

5

Numerical Recipies has Fortran and C++ codes.

In Matlab; Definition: The functions X = fft(x) and x = ifft(X) implementthe transform and inverse transform pair given for vectors of length ....

Syntax• Y = fft(X) example• Y = fft(X,n) example• Y = fft(X,n,dim) example

Descriptionexample

Y = fft(X) computes the discrete Fourier transform (DFT) of X using a fast Fourier transform (FFT) algorithm.

If X is a vector, then fft(X) returns the Fourier transform of the vector.

If X is a matrix, then fft(X) treats the columns of X as vectors and returns the Fouriertransform of each column.

If X is a multidimensional array, then fft(X) treats the values along the first array dimension whose size does not equal 1 as vectors and returns the Fourier transform ofeach vector.

example

Y = fft(X,n) returns the n-point DFT. If no value is specified, Y is the same size as X.

If X is a vector and the length of X is less than n, then X is padded with trailing zeros to length n.

If X is a vector and the length of X is greater than n, then X is truncated to length n.

If X is a matrix, then each column is treated as in the vector case.

If X is a multidimensional array, then the first array dimension whose size does not equal 1 is treated as in the vector case.

example

Y = fft(X,n,dim) returns the Fourier transform along the dimension dim. For example, if X is a matrix, then fft(X,n,2) returns the n-point Fourier transform of each row.

6

ifft Inverse fast Fourier transform

Syntax: y = ifft(X), y = ifft(X,n), y = ifft(X,n,dim)y = ifft(..., 'symmetric'), y = ifft(..., 'nonsymmetric')

Descriptiony = ifft(X) returns the inverse discrete Fourier transform (DFT) of vector X, computed with a fast Fourier transform (FFT) algorithm. If X is a matrix, ifft returns the inverse DFT ofeach column of the matrix.

ifft tests X to see whether vectors in X along the active dimension are conjugate symmetric.If so, the computation is faster and the output is real. An N-element vector x is conjugate symmetric if x(i) = conj(x(mod(N-i+1,N)+1)) for each element of x.

If X is a multidimensional array, ifft operates on the first non-singleton dimension.

y = ifft(X,n) returns the n-point inverse DFT of vector X.

y = ifft(..., 'symmetric') causes ifft to treat X as conjugate symmetric along the active dimension. This option is useful when X is not exactly conjugate symmetric, merely because of round-off error.

y = ifft(..., 'nonsymmetric') is the same as calling ifft(...) without the argument 'nonsymmetric'.

For any X, ifft(fft(X)) equals X to within roundoff error.

Data Type Supportifft supports inputs of data types double and single. If you call ifft with the syntax y = ifft(X, ...), the output y has the same data type as the input X.

Algorithms

The algorithm for ifft(X) is the same as the algorithm for fft(X), except for a sign change and a scale factor of n = length(X). As for fft, the execution time for ifft depends on the length of the transform. It is fastest for powers of two. It is almost as fast for lengths that have only small prime factors. It is typically several times slower for lengths that are prime or which have large prime factors.

Note You might be able to increase the speed of ifft using the utility function

fftw, which controls how MATLAB® software optimizes the algorithm used to compute an FFT of a particular size and dimension.

7

Some atmospheric turbulence data

The data (about 0.5Mb) in file A819856.DAT that I have posted at http://www.yorku.ca/pat/A819856.DAT were collected on July 16, 1988 at the AES Atmospheric Dry Deposition Research Site on CFB Borden. They consist of u, v, w, T(C), and absolute humidity, q(kg m-3). Wind components have units ms-1. Each line represents one record. The data were collected at 5 Hz beginning at 14:00 EDT. There are 2^13 = 8192 records (27.5 mins). A co-ordinate rotation has been performed on the data so that mean v and mean w should equal zero (but check). The data were collected at a height of 33.4 m. The location was over a deciduous forest with a canopy height of about 18 m. The beginning of the file looks like, 5.7867E+00 1.5907E+00 -1.2506E+00 3.2149E+01 1.6120E-02

6.0852E+00 1.1194E+00 -3.0030E-01 3.2103E+01 1.6113E-02

8

Consider Vertical velocity component. First 512 records plus all 2^13

2^13 values; Sample Mean = .0058; Sample Variance = 1.001012

9

-3.

-2.

-1.

0.

1.

2.

3.

4.

0 100 200 300 400 500

S e rie s

-4.

-3.

-2.

-1.

0.

1.

2.

3.

4.

0 2000 4000 6000 8000

S e rie s

Log periodogram

10

-1.00

-.80

-.60

-.40

-.20

.00

.20

.40

.60

.80

1.00

0 5 10 15 20 25 30 35 40

S a m p le A C F

-1.00

-.80

-.60

-.40

-.20

.00

.20

.40

.60

.80

1.00

0 5 10 15 20 25 30 35 40

S a m p le P A C F

-12.

-10.

-8.

-6.

-4.

-2.

0.

2.

4.

.0 .5 1.0 1.5 2.0 2.5 3.0

L o g (P e rio d o g ra m /2 p i)

Basic linear periodogram

11

0.

2.

4.

6.

8.

10.

12.

14.

16.

.0 .5 1.0 1.5 2.0 2.5 3.0

P e rio d o g ra m /2 p i

Matlab use of fft, ifft

% PROGRAM BordenW% Peter Taylorclc; X = csvread('F:\4020-2016\BordenW-2^13.csv');Y = fft(X); plot(X); figure; plot(Y); YR = real (Y); YI = imag (Y); figure; plot(YR); figure ; plot (YI); XX=ifft(Y); figure; plot(XX)

N = length(Y);Y(1) = []; power = abs(Y(1:N/2)).^2;nyquist = 1/2; freq = (1:N/2)/(N/2)*nyquist;l10f = log10(freq); l10p = log10(power);plot(l10f,l10p); grid on; xlabel('log10(cycles/0.2s)');label('log10(power)'); title('Periodogram')

12

Time (milliseconds)

13

14

White noise and periodogram

Periodogram Notes: See Brockwell and Davis Section 4.2

CLOs∙ Develop relationships between operations in the Time Domain and Fourier Analysis and Power Spectrum analysis. Understand the Wiener-Khintchine and Convolution Theorems Apply knowledge to implementation of digital filters

15

.00

.20

.40

.60

.80

1.00

.0 .5 1.0 1.5 2.0 2.5 3.0

P e rio d o g ra m /2 p i

-3.

-2.

-1.

0.

1.

2.

0 50 100 150 200 250

S e rie s

Differentiation and Integrationhttps://en.wikipedia.org/wiki/Fourier_transform#Functional_relationships

Differentiation

Suppose f(x) is a differentiable function, and both f and its derivative f' are integrable. Then the Fourier transform of the derivative is given by .......

More generally, the Fourier transformation of the n-th derivative f(n) is given by .......

By applying the Fourier transform and using these formulas, some ordinary differential equations can be transformed into algebraic equations, which are much easier to solve.

16

Wiener-KhinchinTheorem

http://mathworld.wolfram.com/Wiener-KhinchinTheorem.html

Or seehttps://en.wikipedia.org/wiki/Wiener%E2%80%93Khinchin_theorem

http://ee.caltech.edu/Faculty/babak/courses/ee160/handout_wk.pdf

https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-011-introduction-to-communication-control-and-signal-processing-spring-2010/readings/MIT6_011S10_chap10.pdf

https://www.itp.tu-berlin.de/fileadmin/a3233/grk/pototskyLectures2012/pototsky_lectures_part1.pdf

17

Convolution: In mathematics, the convolution theorem states that under suitable conditions the Fourier transform of a convolution is the pointwise product of Fourier transforms. In other words, convolution in one domain (e.g., time domain) equals point-wise multiplication in the other domain (e.g., frequency domain)

The Fourier transform F(k) = or with t and ν

http://mathworld.wolfram.com/FourierTransform.html http://mathworld.wolfram.com/ConvolutionTheorem.html http://mathworld.wolfram.com/Convolution.html

18

A convolution is an integral that expresses the amount of overlap of one function as it is shifted over another function. It therefore "blends" one function with another.

https://en.wikipedia.org/wiki/Convolution

http://www.dspguide.com/CH6.PDF in "The Scientist and Engineer's Guide toDigital Signal Processing By Steven W. Smith, Ph.D." Several chapters are relevant.

19

DSP = Digital Signal Processing.

20

From: http://www.dspguide.com/CH6.PDF in "The Scientist and Engineer's Guide toDigital Signal Processing By Steven W. Smith, Ph.D."

21

22

23

The Input Side Algorithm

24

25

Reversing x and h gives same y. Convolution is commutative. Is that true for continuous variable form? x(star)h (t) = ∫ x(t')h(t-t')dt' - integral over all t' = h(star)x

26

27

28

29

30

Compare with ARMA processes - is this MA or AR?

31

32

33

34

35

36

37

Borden w data - Gaussian?

38

512 sample histogram

39

-3.

-2.

-1.

0.

1.

2.

3.

4.

0 100 200 300 400 500

S e rie s

20.

40.

60.

80.

100.

-3 -2 -1 0 1 2 3 4

Longer data set, 2^13 points Looks more Gaussian. Impact on dispersion, random walk.

The central limit theorem and the law of large numbers are the two fundamental theorems of probability. Roughly, the central limit theorem states that the distribution of the sum (or average) of a large number of independent, identicallydistributed variables will be approximately normal, regardless of the underlying distribution. The importance of the central limit theorem is hard to overstate; indeed it is the reason that many statistical procedures work.

The law of large numbers states that the sample mean converges to the distribution mean as the sample size increases, and is one of the fundamental theorems of probability.

40

-4.

-3.

-2.

-1.

0.

1.

2.

3.

4.

0 2000 4000 6000 8000

S e rie s

50.

100.

150.

200.

250.

300.

350.

-4 -3 -2 -1 0 1 2 3 4 5

Correlation

41

42

43

44

45

46

from Wikipedia - weather radar

dBZ stands for decibel relative to Z. It is a logarithmic dimensionless technical unit used in radar, mostly in weather radar, to compare the equivalent reflectivity factor (Z) of a radar signal reflected off a remote object (in mm6 per m3) to the return of a droplet of rain with a diameter of 1 mm (1 mm6 per m3).[1] It is proportional to the number of drops per unit volume and the sixth power of drops diameter and is thus used to estimate the rain or snow intensity.[2] With other variables analyzed from the radar returns it helps to determine the type of precipitation. Both the radar reflectivity factor and its logarithmic version are commonly referred to as reflectivity when the context isclear. http://weather.gc.ca/radar/index_e.html

https://www.theweathernetwork.com/ca/weather/ontario/richmond-hill

MAPLE predictions - based on correlations to estimate advectionvelocities of precipitation patterns.

47

Information in time domain or frequency domain, Smith Ch 14

48