# Correlation and Spectral Analysis.ppt

Document Sample

```					Correlation and Spectral
Analysis
Application 4
Review of covariance
Autocorrelation (Autocovariance)
Noise Power
Zero-Mean Gaussian Noise
Power Spectrum
E{Pn(k)} = s2 = 1.12 = Rn(0)
Auto-correlation

Rn(0) = s2 = 1.12

>> for j = 1:256,
R(j) = sum(n.*circshift(n',j-1)');
end
Window Selection: Hamming
y = filter(Hamming,1,n);
Hamming Filtered Power
Spectrum
White Noise Auto-Covariance
vs. Hamming Filtered Noise
Filtered
Noiseimage = imnoise(I,’gaussian’,0,10);
N_autocov = xcorr2(Noiseimage);
figure;imagesc(N_autocov/(128*128));colormap(gray);axis('image')
Image Noise Field                          Autocovariance
Unfiltered

figure;imagesc(fftshift(abs(fft2(N_autocov/(128*128)))));colormap(gray);axis('image')

Image Noise Field                            Power Spectrum
Filtered (wc = 0.6; order 20; Hamming Window)
N_autocov = xcorr2(Noiseimage_filtered);
figure;imagesc(N_autocov/(128*128));colormap(gray);axis('image')

Image Noise Field                          Autocovariance
Filtered (wc = 0.6; order 20; Hamming Window)
N_autocov = xcorr2(Noiseimage_filtered);
figure;imagesc(N_autocov/(128*128));colormap(gray);axis('image')

Image Noise Field                          Power Spectrum
fMRI Simulation
Windowing vs. Filtering
• “Window” applied in temporal or spatial domain
to reduce spectral leakage and ringing artifact
– Windows fall into a specialized set of functions
generally used for spectral analysis

• “Filter” applied to reduce noise, i.e. noise
matching, or to degrade or improve spatial
resolution
– Some cross-over: one method of filter design is the
“window” method which uses window functions for
frequency space modulating functions.
Windowing vs. Filtering
• Mathematically,
Filtering

MP 574
Outline
• Review of FIR/IIR Filters
– Z-transform
– Difference Equation
– Filter Design by Windowing
• Power Spectra
– Correlation and Convolution
– Example from Prof. Holden’s Notes
• Windowing and Spectral Estimation
• Deconvolution
z-Transform as an Analysis Tool

• Sampled version (discrete version) of
the Laplace transform:
• z ®esT, where T is the sampling period.
• DFT and z-transform are related:
z = eiwT where s ® eiwT
Laplace to z-Transform

Im(z)
Non-causal
iw                        unit circle
signals
0        Re(z)
s                        ws

Discrete FT

Continuous FT
z-Transform and Linear
Systems
• Stated more generally:
T{f(n)}
f(n)                    g(n)

h(n)
Difference Equation
Implementation
• Shift theorem of z-transform:
Difference Equation
Implementation
• Shift theorem of z-transform:

FIR
FIR Coefficients and Impulse
Response
• FIR filter:
FIR vs. IIR filters
• Finite impulse response (FIR) implies a
linear system that is always stable
– There are no poles
• Infinite impulse response (IIR) is only
stable if poles are inside the unit circle or
pole coincides with a zero.
IIR System
Im(z)
Zeros (o) at: -1, 2
Poles (x) at: 0.5±0.5j, 0.75       unit circle
x                Re(z)
o        x        o
x
IIR Stability
fvtool(B,A)

B = [1 -1 -2];
A=[1 -1.75 1.25 -0.375]
fvtool(B,A)
fvtool(B,A)
Unstable
B = [1 -1 -2];
A=[1 -1.75 1.25 -0.6]
Unstable
B = [1 -1 -2];
A=[1 -1.75 1.25 -0.6]
Finite impulse response (FIR)
B = [1 -1 -2];
A=[1]
Definition of Stability
FIR filter Design by Windowing
• Simply truncate IIR filter
• Rectangular Window:
Matlab: fdatool
filter() in Matlab
FILTER One-dimensional digital filter.
Y = FILTER(B,A,X) filters the data in vector X with the
filter described by vectors A and B to create the filtered
data Y. The filter is a "Direct Form II Transposed"
implementation of the standard difference equation:

a(1)*y(n) = b(1)*x(n) + b(2)*x(n-1) + ... + b(nb+1)*x(n-nb)
- a(2)*y(n-1) - ... - a(na+1)*y(n-na)
Exporting Filter Coefficients
Extension to 2D
– H(k)-> (H(k1)2+H(k2)2)1/2=T(k1,k2)
– See Matlab script on filter design using radial
transformation to 2D: Filter Design
• Parks-McClellan Transformation
– Step 1: Translate specifications of H(w1,w2) to H(w)
– Step 2: Design 1D filter H(w)
– Step 3: Map to 2D frequency space
cosw = - ½ + ½ cosw1 + ½ cosw2 + ½ cosw1 cosw2 = T(w1,w2)
- Step 4: determine h(n1,n2) by 2D FT.
Hamming Window Example
Hamming Window Example

>> w1 = -pi:0.01:pi;
>> w2 = -pi:0.01:pi;
>> [W1,W2] = meshgrid(w1,w2);
>> H_2d = 0.54+0.46.*(-0.5+0.5.*cos(W1)+0.5.*cos(W2)+0.5.*cos(W1).*cos(W2));
>>figure;mesh(H_2d)

filter2()
2D FIR Filter Design,
Parks-McClellan
“firdemo”

```
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
 views: 0 posted: 1/9/2014 language: English pages: 50
Lingjuan Ma