Centre for Mathematical Sciences HT 2017 Mathematical Statistics

Similar documents
Centre for Mathematical Sciences HT 2017 Mathematical Statistics. Study chapters 6.1, 6.2 and in the course book.

Centre for Mathematical Sciences HT 2018 Mathematical Statistics

Computer Exercise 0 Simulation of ARMA-processes

Additional exercises in Stationary Stochastic Processes

Assignment 2. Signal Processing and Speech Communication Lab. Graz University of Technology

Lab 4: Quantization, Oversampling, and Noise Shaping

Computer Exercise 1 Estimation and Model Validation

Fourier Methods in Digital Signal Processing Final Exam ME 579, Spring 2015 NAME

Adaptive Filtering. Squares. Alexander D. Poularikas. Fundamentals of. Least Mean. with MATLABR. University of Alabama, Huntsville, AL.

E2.5 Signals & Linear Systems. Tutorial Sheet 1 Introduction to Signals & Systems (Lectures 1 & 2)

Lecture 7 Random Signal Analysis

Test 2 Electrical Engineering Bachelor Module 8 Signal Processing and Communications

Laboratory Project 2: Spectral Analysis and Optimal Filtering

LAB 2: DTFT, DFT, and DFT Spectral Analysis Summer 2011

EEM 409. Random Signals. Problem Set-2: (Power Spectral Density, LTI Systems with Random Inputs) Problem 1: Problem 2:

Practical Spectral Estimation

ADSP ADSP ADSP ADSP. Advanced Digital Signal Processing (18-792) Spring Fall Semester, Department of Electrical and Computer Engineering

System Modeling and Identification CHBE 702 Korea University Prof. Dae Ryook Yang

II. Nonparametric Spectrum Estimation for Stationary Random Signals - Non-parametric Methods -

EEG- Signal Processing

Model-building and parameter estimation

The Cooper Union Department of Electrical Engineering ECE111 Signal Processing & Systems Analysis Final May 4, 2012

2. SPECTRAL ANALYSIS APPLIED TO STOCHASTIC PROCESSES

Experimental Fourier Transforms

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science : Discrete-Time Signal Processing

Discrete-Time Gaussian Fourier Transform Pair, and Generating a Random Process with Gaussian PDF and Power Spectrum Mark A.

V(t) = Total Power = Calculating the Power Spectral Density (PSD) in IDL. Thomas Ferree, Ph.D. August 23, 1999

Solutions for examination in TSRT78 Digital Signal Processing,

Lab 3: The FFT and Digital Filtering. Slides prepared by: Chun-Te (Randy) Chu

Linear models. x = Hθ + w, where w N(0, σ 2 I) and H R n p. The matrix H is called the observation matrix or design matrix 1.

6.435, System Identification

Review of spectral analysis methods applied to sea level anomaly signals

Chapter 3. Data Analysis

Problem Set 2 Solution Sketches Time Series Analysis Spring 2010

Lesson 1. Optimal signalbehandling LTH. September Statistical Digital Signal Processing and Modeling, Hayes, M:

Exercises in Digital Signal Processing

Adaptive Systems Homework Assignment 1

Correlation, discrete Fourier transforms and the power spectral density

Topic 7. Convolution, Filters, Correlation, Representation. Bryan Pardo, 2008, Northwestern University EECS 352: Machine Perception of Music and Audio

/ (2π) X(e jω ) dω. 4. An 8 point sequence is given by x(n) = {2,2,2,2,1,1,1,1}. Compute 8 point DFT of x(n) by

A=randn(500,100); mu=mean(a); sigma_a=std(a); std_a=sigma_a/sqrt(500); [std(mu) mean(std_a)] % compare standard deviation of means % vs standard error

SNR Calculation and Spectral Estimation [S&T Appendix A]

Homework 9 Solutions

ANALOG AND DIGITAL SIGNAL PROCESSING ADSP - Chapter 8

DFT & Fast Fourier Transform PART-A. 7. Calculate the number of multiplications needed in the calculation of DFT and FFT with 64 point sequence.

Course content (will be adapted to the background knowledge of the class):

Laboratory Project 1: Introduction to Random Processes

MATLAB and Mathematical Introduction Will be discussed in class on 1/24/11

Evaluating Fourier Transforms with MATLAB

Technische Universität Kaiserslautern WS 2016/17 Fachbereich Mathematik Prof. Dr. J. Franke 19. January 2017

ECE 450 Homework #3. 1. Given the joint density function f XY (x,y) = 0.5 1<x<2, 2<y< <x<4, 2<y<3 0 else

LAB 6: FIR Filter Design Summer 2011

ELEG 3143 Probability & Stochastic Process Ch. 6 Stochastic Process

EE538 Final Exam Fall 2007 Mon, Dec 10, 8-10 am RHPH 127 Dec. 10, Cover Sheet

Chapter [4] "Operations on a Single Random Variable"

Frequency Domain Speech Analysis

6.003 (Fall 2011) Quiz #3 November 16, 2011

Problem Sheet 1 Examples of Random Processes

Module 4. Signal Representation and Baseband Processing. Version 2 ECE IIT, Kharagpur

Distortion Analysis T

3. ESTIMATION OF SIGNALS USING A LEAST SQUARES TECHNIQUE

Detailed Solutions to Exercises

CONTENTS NOTATIONAL CONVENTIONS GLOSSARY OF KEY SYMBOLS 1 INTRODUCTION 1

13. Power Spectrum. For a deterministic signal x(t), the spectrum is well defined: If represents its Fourier transform, i.e., if.

Parametric Method Based PSD Estimation using Gaussian Window

Communications and Signal Processing Spring 2017 MSE Exam

E : Lecture 1 Introduction

DISCRETE-TIME SIGNAL PROCESSING

CONTROL SYSTEMS, ROBOTICS, AND AUTOMATION - Vol. V - Prediction Error Methods - Torsten Söderström

Non-parametric identification

Introduction to Computational Stochastic Differential Equations

Elec4621 Advanced Digital Signal Processing Chapter 11: Time-Frequency Analysis

ECE Homework Set 3

Autoregressive tracking of vortex shedding. 2. Autoregression versus dual phase-locked loop

Lecture 4 - Spectral Estimation

Advanced Digital Signal Processing -Introduction

Engineering Geodesy I. Exercise 3: Monitoring of a Bridge Determination of the Eigenfrequencies

18.085: Summer 2016 Due: 3 August 2016 (in class) Problem Set 8

CHAPTER 2 RANDOM PROCESSES IN DISCRETE TIME

2A1H Time-Frequency Analysis II

Chirp Transform for FFT

x[n] = x a (nt ) x a (t)e jωt dt while the discrete time signal x[n] has the discrete-time Fourier transform x[n]e jωn

Random signals II. ÚPGM FIT VUT Brno,

Time Series Analysis

Spectral Analysis - Introduction

GEORGIA INSTITUTE OF TECHNOLOGY SCHOOL of ELECTRICAL & COMPUTER ENGINEERING FINAL EXAM. COURSE: ECE 3084A (Prof. Michaels)

Time Series Examples Sheet

A Mathematica Toolbox for Signals, Models and Identification

HST-582J/6.555J/16.456J Biomedical Signal and Image Processing Spring Laboratory Project 3 Blind Source Separation: Fetal & Maternal ECG

Lab 4: Introduction to Signal Processing: Fourier Transform

Definition. A signal is a sequence of numbers. sequence is also referred to as being in l 1 (Z), or just in l 1. A sequence {x(n)} satisfying

Chapter 1 Linear Equations. 1.1 Systems of Linear Equations

INTERSECTIONS OF PLANES

Problem Value

From Fourier Series to Analysis of Non-stationary Signals - X

Nov EXAM INFO DB Victor Phillip Dahdaleh Building (DB) - TEL building

Stochastic Processes. A stochastic process is a function of two variables:

Electrical Engineering Written PhD Qualifier Exam Spring 2014

INTERSECTIONS OF PLANES

Übersetzungshilfe / Translation aid (English) To be returned at the end of the exam!

Transcription:

Lund University Stationary stochastic processes Centre for Mathematical Sciences HT 2017 Mathematical Statistics Computer exercise 3 in Stationary stochastic processes, HT 17. The purpose of this exercise is to study different techniques for spectral density estimation and some examples using the cross-spectrum and the coherence estimate. 1 Preparations Read through the entire computer exercise. Study chapter 6.5 and 9 in the course book and familiarize yourself with the Matlab functions, fft, periodogram, pwelch, cpsd, and mscohere. Answer the exercises in the question dictionary 1.1 below and E-mail your answers to FMSF10@matstat.lu.se at latest by Monday October 9 at 12.00 noon. The answers can be written in english or swedish by hand (readable) or in any text editor program but the final attached file should be a pdf-file. Use the following in the subject row, Assignment 3 by tpi07xyz (one student) or Assignment 3 by tfy08xyz and nat09xyz (two students). Larger group sizes than two are not allowed. Note that you might be asked to explain your answers during the exercise. 1.1 Question dictionary 1) Why should you apply zero-padding when you estimate the spectral density using the FFT? 2) Briefly explain how you can improve the periodogram using a data window technique. What are the advantages and disadvantages? 3) What is the covariance function of the stationary process x(t) = A cos(2πf 0 t + φ), t = 0, ±1, ±2,..., where A and φ Rect(0, 2π) are independent stochastic variables? If you have just n available samples of a realization of this process and use the inverse Fourier transform of the periodogram as an estimate of the covariance function, how would the expected value of the estimate look? Sketch the view. Hint: study page 240 and Eq. (9.7). 4) Define an expression for the window length of the time-shifted data window of Welch method using 50 % overlap, if the total number of windows are K and the number of available samples are n. (It is not available in the course book!) Turn to the next page! 1

5) The periodogram has large variance. Approximately how large? If you instead apply the Welch method with K windows, and 50% overlap, how large is the reduction of the variance? 6) Define an expression for the cross-spectral density and the squared coherence spectrum between the input and output from a linear filter according to, Y (t) = h(t u)x(u)du. Note that there is no disturbing noise. Simplify the expression as far as you can. 2 The periodogram and zero-padding Please find the additional files and data on the webpage and load these into your computer. Receiving a file of (possibly unknown) data, the first step before more advanced spectral analysis always should be to make a check of the spectral content and possible strong disturbances, e.g., 50 Hz from the electricity current. Some basic algorithm, such as the periodogram can be used for a first view. Load the file unknowndata. The unknown data is contained in data. Plot the data and check if there seems to be a large mean that differ from zero. If this is the case, the periodogram analysis will not work properly and an estimated mean, should be subtracted before the analysis. Decide if this is the case and in that case adjust data to zero-mean. Your own periodogram is easily implemented using the Discrete Fourier Transform (DFT) and can be computed in Matlab, using the command fft >> X=fft(x); and >> n=length(x); >> Rhat=(X.*conj(X))/n; >> f=[0:n-1]/n; >> plot(f,rhat) If you prefer the view of frequencies 0.5 f < 0.5, use the command fftshift according to >> plot(f-0.5,fftshift(rhat)) Q. What do you see? Can you say anything about the signal? 2

An much better resolution view is given using zero-padding, i.e., >> X=fft(x,N); where N specifies the number of frequency values your spectrum estimate is computed for. For fast computation the number of frequency values should be chosen as N = 2 I where I is an integer, (e.g., N=512, 1024, 2048, 4096...). Compute and plot the resulting spectrum estimate, >> Rhat=(X.*conj(X))/n; >> f=[0:n-1]/n; >> plot(f,rhat) Note that the normalizing factor of the spectral estimate should still be the data length and not the FFT-length N. Q. How does the use of zero-padding change your spectral estimate? The unknown signal is a realization of a cosine function process, see preparation exercise 2, (initially with a non-zero-mean). Can you identify the frequency? The inverse FFT can be used to compute the covariance function estimate, and we plot the values for small τ, τ = 0,..., 15, as >> rhat=ifft(rhat); >> plot([0:15],rhat(1:16)) Q. Can you explain the shape of the estimate from theory? (Compare with preparation exercise 3) 3

3 Investigation of different spectrum estimation techniques Different non-parametric spectrum methods should be compared in their ability to estimate realizations of an ARMA-process. Investigate the ARMA(4,2)-process, >> modell.a=[1-2.39 3.35-2.34 0.96]; >> modell.c=[1 0 1]; by importing the model to armagui. Q. Where are the poles and zeros? Sketch the spectral density in linear and logarithmic scales and note the frequencies where the peaks and zeros are located. Simulate a 500 sample realization yourself using >> e = randn(500,1); >> x = filter(modell.c, modell.a, e); Estimate the spectral density using the Matlab periodogram function, with zeropadding up to fft-length 4096, >> periodogram(x,[],4096); which depicts in db-scale. Note the frequency-scale normalized between 0 and 1, but this is just Matlab normalization which actually should be interpreted as 0 to 0.5! Compare with the true spectral density and the frequency locations of peaks and zeros from armagui. Run the three commands above again to plot the periodogram of a new simulated realization. Note the large variation in the spectrum estimate from realization to realization! Now compute a spectrum estimate using a Hanning windowed, (modified) periodogram, >> periodogram(x,hanning(500),4096); 4

Q. How does the periodogram and the Hanning windowed periodogram differ? Sketch the estimates and explain. To visualize in linear/logarithmic scale and to receive the computed spectrum estimates as output from the periodogram function use >> [Rhat,f]=periodogram(x,[],4096,1); >> plot(f,rhat) % Linear scale >> semilogy(f,rhat) % Logarithmic scale where the last 1 after the fft-length 4096 is the sampling frequency. Specifying this will give the output frequency axis f between 0 and 0.5, which is convenient. See the Matlab documentation for further details. Now use the Welch method with K=10 time-shifted Hanning windows and 50% overlap. The length L of the time-shifted window needs to be specified. Use your result from preparation exercise 5. >> pwelch(x,hanning(l),[],4096); Simulate another realization (or a few other) of your ARMA-process, see the start of section 3, and apply the Welch method for the spectrum estimate. Q. What are the differences using the Welch estimator compared to the periodogram? Sketch and explain. A simple performance analysis of methods can be made using just a white noise sequence, i.e., e of your ARMA-process. As the spectrum estimate of the white noise sequence should be constant we can compare the variance of the spectrum estimates of a single realization, e.g., from the periodogram and the Welch method, 5

>> Rhate=periodogram(e,[],4096); >> Rhatew=pwelch(e,hanning(L),[],4096); where we compute the variances of Rhate and Rhatew and the ratio of them, i.e., >> var(rhate)/var(rhatew) Repeat this a few times for a new simulation of the white noise sequence. Q. What is the relation between the two variances? Is this in concordance with theory? If you are interested, also use the Thomson multitaper estimator with 10 multitapers and compare the resulting spectrum estimate to the result of the Welch estimator. >> pmtm(x,(10-1)/2,[],4096); 4 Identification of stationary Gaussian processes 4.1 Spectral estimates Load the data of the file, threeprocessdata. The sequences y1, y2, and y3 are realizations of length N from three different zero-mean processes for which the spectral densities are seen in the figure below. We identify A as an AR(5)-process, B as an ARMA(2,4)-process and C as some low-frequency process (an MA(128), white Gaussian noise filtered through a linear-phase FIR-filter, fir1 in Matlab). The task is now to combine the correct spectral density with the corresponding sequence, y1, y2, or y3, (one from each process), using all tools you have learned. As additional information you also have the white Gaussian noise sequences, x1, x2, and x3, that have been used as input sequences of the filters, from which the outputs are the sequences y1, y2, and y3, respectively. Plot the sequences, y1, y2, and y3, and calculate the covariance functions using covf. When the frequency contents of realizations are very similar, visualization of data and covariance estimates are not the best tools. Estimate the spectral densities using the periodogram (with some zero-padding), for the three process realizations. Also use the Welch method, e.g., with K = 10 time-shifted Hanning windows and study the resulting spectrum. If you have time, change the window length (and thereby also the number of windows) and study the results. 6

20 A 20 B 20 C 10 10 10 0 0 0-10 -10-10 10 log 10 RY (f) -20-30 -20-30 -20-30 -40-40 -40-50 -50-50 -60-60 -60-70 0 0.2 0.4 f -70 0 0.2 0.4 f -70 0 0.2 0.4 f Figure1: The spectral densities of the three processes. Q. Compare your periodograms and Welch spectra and the true spectral densities of Figure 1. Identify which sequence that belongs to each of the spectral densities, A, B and C. Sketch and explain. 4.2 Coherence spectrum You have possibly a good guess of what process each of the realizations comes from, although maybe you are not definitely sure. However, as we also have access to the input sequences, x1, x2, and x3, (white zero-mean Gaussian noise), we could use the cross-spectrum and coherence spectrum to further investigate the realizations. If you want to be sure that no mistakes have been made in the data description and labeling, verify that the input sequences actually are white noise sequences using the Welch method. We choose the sequences the y1 and y3, and would also like to use information from the input sequences x1 and x3. Talking with the colleague that sent you the data file, you get indications that the input sequences x1 and x3 might have been mixed up and that actually x1 is x3 and x3 is x1. You can easily check this using the coherence spectra 7

between the input sequences (and the shifted input sequences) and output sequences of respective process using the Welch estimator, with 10 windows and overlap 50 %, i.e. >> mscohere(x1,y1,hanning(l),[],4096); >> mscohere(x3,y1,hanning(l),[],4096); Q. What is the coherence spectral density according to theory, (see preparation exercise 6)? Relating to this knowledge, which of your coherence estimates seems to be correct? Were the names of the input sequences shifted? 4.3 Cross-spectrum and amplitude function estimate Make sure that you have the correct names of your input sequences. Use the Welch method to compute the cross-spectrum estimate of the correctly data pairs >> Rxy=cpsd(x1renamed,y1,hanning(L),[],4096); and the spectrum estimate of the input noise sequence, >> Rxx=pwelch(x1renamed,hanning(L),[],4096); and plot an estimate of the amplitude function of the respective filter, see preparation exercise 6. You can verify if the estimate is correct depicting the absolute value of H, using the Matlab function H=tfestimate(x1renamed,y1,hanning(L),[],4096);. For two of the sequences, the estimated amplitude functions should be in concordance with the theoretical ones presented in the Figure 1. If you have time you can estimate the amplitude function of sequence pair number 2 even better. Use the frequency function estimate from a Hanning windowed periodogram to compute the impulse response of the filter, >> H=tfestimate(x2,y2,hanning(500),[],4096, twosided ); >> h=ifft(h); Compare with the impulse responses of sequence pairs 1 and 3. The impulse response from sequence pair number 2 does have its maximum at a high value of t = 64. This means that y2 is 64 samples delayed compared to x2. This is usual not a problem in estimation of frequency function if the delay is small and the total number of samples 8

reasonably large. However, for short sequences, and when the Welch method is applied with many short windows resulting in short sequences, the two data sequences used for the estimate of the cross-spectrum are no longer correlated and accordingly, the cross-spectrum will not show the actual dependence. A good advice is to be careful and estimate the frequency function and corresponding impulse response and the time delay, correct for the time delay, and then compute the frequency function. Cut out the correct corresponding parts of x2 and y2, corrected for the time delay and compute the amplitude function using just these pieces of data. The result should now be in concordance with subplot C of Figure 1! 9