CCEE534 Signal Processing Correlation PDF
Document Details
Uploaded by CarefreeMinotaur
Rafik Hariri University (RHU)
null
Dr. Oussama Mustapha
Tags
Summary
This document presents lecture notes on signal processing and correlation. It covers various applications of correlation in different fields such as engineering, biomedical, finance, and environmental science. The document also describes types of correlation, including positive, negative, and zero correlations, and properties and applications of continuous and discrete correlation.
Full Transcript
CCEE534- Signal Processing Correlation Dr. Oussama Mustapha Rafik Hariri University (RHU) 1 Outlines Continuous cross-correlation Continuous auto-correlation Discrete cross-correlation Discrete auto-correlation...
CCEE534- Signal Processing Correlation Dr. Oussama Mustapha Rafik Hariri University (RHU) 1 Outlines Continuous cross-correlation Continuous auto-correlation Discrete cross-correlation Discrete auto-correlation 2 Cross-correlation Cross-correlation Crosscorrelation is a measure of the similarity between two signals as a function of time shift between them. Crosscorrelation is used in signal processing to identify relationships between signals. Crosscorrelation involves comparing two signals by shifting one relative to the other and calculating the correlation coefficient at each shift. 4 Cross-correlation Crosscorrelation is used in: image processing: to align two images and identify common features. speech recognition: to match a spoken word with a stored dictionary of words. pattern recognition: to identify similarities between different patterns. Signal denoising. Determining time lag (delay) between two signals. 5 Applications-Engineering Pattern recognition. Fault detection. System identification. Image processing. Communication: To extract information from noisy signals. 6 Applications-Biomedical To analyze heart signals (ECG): To identify abnormalities in the heart's electrical activity. To analyze brain signals (EEG): To identify patterns in the brain's electrical activity in order to diagnose conditions such as epilepsy and sleep disorders. To analyze muscle signals (EMG): To identify the muscle activity: fatigue,….. 7 Applications-Finance Crosscorrelation can be used to analyze the correlation between stock prices and interest rates. Crosscorrelation is also used to identify pattern in financial data and make trading decisions. 8 Applications-Environmental Science Crosscorrelation can be used to analyze the correlation between temperature and rainfall. Crosscorrelation is also used in climate modeling to identify patterns in climate data and make predictions about future climate trends. 9 Applications - Music Crosscorrelation analysis is used to analyze the similarity between different musical pieces. 10 Applications Advantages of Crosscorrelation Time-Domain Analysis Crosscorrelation analysis is a time- domain analysis technique. Crosscorrelation analyzes the signals in the time domain rather than the frequency domain. 12 Advantages of Crosscorrelation Robustness to Noise Crosscorrelation analysis can effectively filter out the noise and reveal the underlying patterns in the signals. This is because crosscorrelation between two noise signals, shifted by one sample, is null. 13 Advantages of Crosscorrelation Detection of Hidden Signals Crosscorrelation analysis can detect hidden signals in noisy data. 14 Advantages of Crosscorrelation Pattern Recognition Crosscorrelation analysis is an excellent technique for pattern recognition. 15 Advantages of Crosscorrelation Comparison of Signals Crosscorrelation analysis can be used to compare signals to each other. This can be particularly useful in applications where the signals are similar but not identical. 16 Advantages of Crosscorrelation Types of cross correlations Positive Correlation A relationship between two variables in which both variables move in tandem. A positive correlation exists when as one variable decreases, the other variable also decreases and vice versa. In statistics, a perfect positive correlation is represented by the value +1. 18 Types of cross correlations Negative Correlation A relationship between two variables in which one variable increases as the other decreases and vice versa. In statistics, a perfect negative correlation is represented by the value -1. 19 Types of cross correlations No Correlation or Zero Correlation If there is no relationship between the two variables such that the value of one variable change and the other variable remain constant is called no or zero correlation. In statistics, a perfect zero correlation is represented by the value 0. 20 Cross correlation Application (signal identification) 10 s1 0 -10 0 500 1000 1500 2000 2500 3000 10 s2 0 -10 0 500 1000 1500 2000 2500 3000 10 s3 0 -10 0 500 1000 1500 2000 2500 3000 Rxs1 ( ) 3.7354 Unknown signal 5 0 Rxs 2 ( ) 6.1143 -5 Rxs3 ( ) 4.5987 0 500 1000 1500 2000 2500 3000 Cross correlation Application (signal identification) clc subplot(411) R=randn(1,1000); plot(s1) s1=[R 2*R R]; ylabel('s1') s2=[R 2+R R]; subplot(412) s3=[2*R R 2*R]; plot(s2) x=[1.7*R R 0.9*R]; ylabel('s2') subplot(413) x1=xcorr(x,s1); plot(s3) max(x1) ylabel('s3') x2=xcorr(x,s2); subplot(414) max(x2) plot(x) x3=xcorr(x,s3); ylabel('Unknown signal') max(x3) Cross correlation Application (signal identification) Cross correlation can be used to identify a signal by comparison with a library of known reference signals. The unknown signal is correlated with a number of known reference signals. The correlation will be high if the reference is similar to the unknown signal. The largest value for correlation is the most likely match. In our case: Unknown signal is similar to S2. 23 Cross correlation Application on signals (Bird) 24 Cross correlation Application on signals (Sonar) Cross correlation is one way in which sonar can identify different types of vessel: Each vessel has unique sonar 'signature'. The sonar system has a library of pre-recorded echoes from different vessels. An unknown sonar echo is correlated with a library of reference echoes. The largest correlation is the most likely match. 25 Cross correlation Application (Signal denoising) By computing the crosscorrelation between the noisy signal and the original signal, we can estimate the noise component in the noisy signal. Once we have identified the noise component, we can subtract it from the noisy signal to obtain the clean signal. 26 Cross correlation Application (Signal denoising) clc 4 t=0:pi/30:17*pi; 2 s=sin(t); 0 -2 R=randn(1,length(s)); -4 0 100 200 300 400 500 600 y=s+0.7*R; 400 c=xcorr(s,y); 200 0 -200 -400 subplot(211) 0 200 400 600 800 1000 1200 plot(y) subplot(212) plot(c) Cross correlation Application (signal extraction fom noisy Signal) clc 100 t=0:pi/30:17*pi; 50 s=sin(t); 0 R=randn(1,length(s)); -50 y=s+30*R; -100 c=xcorr(s,y); 0 100 200 300 400 500 600 1000 subplot(211) 500 plot(y) 0 -500 subplot(212) -1000 plot(c) -1500 0 200 400 600 800 1000 1200 Cross correlation Application (Time lag) Crosscorrelation function is used to find the time lag between two signals. By computing the crosscorrelation between the two signals, we can find the time lag that maximizes the crosscorrelation. 29 Cross correlation Application (Time lag) 30 Cross correlation Application (Time lag) Cross correlation Application (Time lag) 5 0 -5 0 100 200 300 400 500 600 700 800 900 1000 5 0 -5 0 500 1000 1500 2000 2500 3000 2000 1000 0 -1000 0 1000 2000 3000 4000 5000 6000 Cross correlation Application (Time lag) clc R=randn(1,1000); s1=[zeros(1,2000) R]; y=xcorr(s1,R); f=find(y==max(y)) subplot(311) plot(R) subplot(312) plot(s1) subplot(313) plot(y) Auto-correlation 34 Auto correlation Auto correlation: Is the degree of similarity between a given signal and a lagged version of itself. 35 Auto correlation (Random signal) 4 2 0 -2 -4 0 100 200 300 400 500 600 700 800 900 1000 1000 500 0 -500 0 200 400 600 800 1000 1200 1400 1600 1800 2000 Random noise is similar to itself, and in phase. With no time shift: Its correlation function is spike. 36 Auto correlation (Random signal) clc R=randn(1,1000); y=xcorr(R,R); subplot(211) plot(R) subplot(212) plot(y) 37 Auto correlation (Periodic signal) The autocorrelation function of a periodic signal is a periodic signal. The period of the autocorrelation function is same as that of the original signal. 38 Auto correlation (Periodic signal) clc t=0:pi/30:17*pi; s=sin(t); 1 0.5 0 y=xcorr(s,s); -0.5 -1 0 100 200 300 400 500 600 400 200 0 -200 subplot(211) -400 0 200 400 600 800 1000 1200 plot(s) subplot(212) plot(y) 39 Auto correlation (Periodic signal) 1 0.5 0 -0.5 -1 0 100 200 300 400 500 600 400 200 0 -200 -400 0 200 400 600 800 1000 1200 40 Auto correlation (Noisy signal) 4 2 0 -2 -4 0 100 200 300 400 500 600 600 400 200 0 -200 -400 0 200 400 600 800 1000 1200 Random noise has a distinctive 'spike' autocorrelation function. A sine wave has a periodic autocorrelation function. 41 Auto correlation (Noisy signal) clc t=0:pi/30:17*pi; s=sin(t); R=randn(1,length(s)); y=s+0.7*R; c=xcorr(y,y); subplot(211) plot(y) subplot(212) plot(c) 42 Auto correlation (Noisy signal) 4 2 0 -2 -4 0 100 200 300 400 500 600 600 400 200 0 -200 -400 0 200 400 600 800 1000 1200 43 Continuous Cross-correlation 44 Continuous cross-correlation The cross-correlation function of x(t) and y(t) is defined as: Rxy ( ) x(t ) y (t )dt The cross-correlation of real-valued signals is: Rxy ( ) x(t ) y(t )dt 45 Continuous cross-correlation Orthogonality. Two signals x(t) and y(t) are said to be orthogonal if: Rxy (0) x (t ) y (t )dt 0 46 Properties of the cross-correlation function 47 Continuous cross-correlation 1) Commutativity: The cross-correlation function is not commutative: Rxy ( ) R yx ( ) 48 Continuous cross-correlation 1) Commutativity: The cross-correlation function is not commutative: >> a=[1 3 7]; >> b=[2 1 3]; >> y=xcorr(a,b) y = 3.0000 10.0000 26.0000 13.0000 14.0000 >> y=xcorr(b,a) y =14.0000 13.0000 26.0000 10.0000 3.0000 49 Continuous cross-correlation 2) Correlation theorem. The cross-correlation of two signals x(t) and y(t) corresponds to the multiplication of their Fourier Transform: F Rxy ( ) X ( F ).Y ( F ) 50 Continuous cross-correlation 3) Periodicity. the cross-correlation function of two periodic signals x(t) and y(t) is given by: T 2 1 Rxy ( ) x(t ) y (t )dt T T 2 The cross-correlation function Rxy(τ) of periodic signals is also periodic. 51 Continuous auto-correlation 52 Continuous auto-correlation The auto-correlation function of a signal x(t) is given by: Rxx ( ) x(t ) x (t )dt The auto-correlation function of a signal x(t) can be written as: Rxx ( ) x (t ) x(t )dt The auto-correlation function real-valued function x(t) is: Rxx ( ) x(t ) x(t )dt x(t ) x(t )dt 53 Properties of the auto-correlation function Continuous auto-correlation 1) Commutativity: The auto-correlation function is not commutative: Rxx ( ) R xx ( ) 55 Continuous auto-correlation 2) The auto-correlation function of a real- valued signal x(t) is: Rxx ( ) Rxx ( ) The auto-correlation function is even. 56 Continuous auto-correlation 3) The maximum of the auto-correlation function is at the origin: Rxx ( ) Rxx (0) If (τ) increases, the similarity of the signal with itself (shifted by τ ) decreases. 57 Continuous auto-correlation 4) The value of the auto-correlation function at the origin (τ=0) is equal to the energy of the signal: Rxx (0) x(t ) x(t )dt x(t ) dt E 2 58 Continuous auto-correlation 5) The Fourier Transform of the auto- correlation function is equal to the energy spectral density of the signal: F Rxx ( ) X ( F ). X ( F ) X ( F ) 2 59 Continuous auto-correlation 6) The auto-correlation function of a periodic signal x(t) is periodic: T 1 2 Rxx ( ) (t )dt x (t ) x T T 2 60 Discrete correlation Discrete cross-correlation The discrete cross-correlation of x(n) and y(n) is: Rxy ( ) x(n) y (n ) The discrete auto-correlation of x(n) and y(n) is: Rxx ( ) x(n) x(n ) n 62 Convolution / cross-correlation The relationship between the discrete cross- correlation in terms of convolution is: Rxy ( ) x( ) * y( ) 63 Summary of the correlation properties 1) Rxx (0) is the mean-square value of the process x(n). 2) Rxx ( ) is an even function of τ. 3) Rxx ( ) Rxx (0) for all values of τ. 4) If x(n) contains a periodic component, Rxx ( ) will also contain a periodic component with the same period. 64 Summary of the correlation properties 5) If x(t) and y(t) are exactly the same random signal: Rxy = Rxx = Ryy. 6) If (x) is delayed with respect to the other (y), Y(t)=x(t+t0). The peak of the cross-correlation occurs at time delay t0. 65 Convolution / cross-correlation Cross-correlate the two signals: x(n)=[1 3 7] and h(n)=[2 1 3] 1 3 7 3 3 9 21 1 1 3 7 2 2 6 14 y(n) = x(τ)*y(-τ) = [3 10 26 13 14] Questions ? 67