Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most...

24
Sampling Theorem, frequency resolution & Aliasing e Sampling Theorem will be the single st important constraint you'll learn in mputer-aided instrumentation design nsider a periodic function, with period T:

Transcript of Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most...

Page 1: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.

Sampling Theorem, frequency resolution &

Aliasing

The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation design

Consider a periodic function, with period T:

Page 2: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.

Where we have applied a low-pass “anti-aliasing” filter to the raw analog signal ending up with h(t), a signal with a highest freq component < 10*ω0

Fourier Series

Page 3: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.

Or…generate 20 independent equations by sampling. We must sample 20 times during one period. (If we sample over more than one period, we may not end up with independent equations.) Each equation will be of the form: {tm} is the set of sample times…

Ak , Bk: Fourier spectrum coefficients

Page 4: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.

The matrix (C) of coefficients looks like:

Page 5: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.

Where matrix C must have a non-zero determinant

Let the 20 x 20 matrix be C:

with the solution

Page 6: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.

Coefficients become spectrum: magnitude

Phase change as a function of ω:

Page 7: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.

Spacing of samples

If the sample spacing is uniform there will be 2N segments of time, (time between samples) Therefore the sample rate is

2N/T.

The maximum frequency in h(t) is

Therefore you must sample at at least 2*fmax to insure you can resolve fmax freq.

Page 8: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.

statement of the Sampling Theorem, from A. V. Oppenheim and A. S. Willsky, Signals and Systems, 2nd Ed. Prentice-Hall (1996) p. 518

Page 9: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.

Nyquist what?

• Terminology: The sampling frequency of a particular situation, which may exceed by quite a bit the maximum frequency in the signal, is the Nyquist frequency. Twice the maximum frequency of the signal is called the Nyquist rate, and is the minimum sampling rate that can resolve the signal. (O&W, 1st Ed, p. 519)

Page 10: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.

Resolvable frequency in spectrum

• Given the sampling rate, and the number of samples taken, what is the Δf between points on the spectrum?

• If a waveform is sampled for one second, what is the frequency resolution?

• No matter how long you sample for, the maximum reconstructable frequency remains 2*f_samp

Page 11: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.

function Test_FFT_11c(wind_flg)

Page 12: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.

Discrete Fourier Transform• Transform vs Series?• Computing the coefficients can take time…(bench)• Demo with Matlab fft and ifft functions (& Lab 6 HP ‘scope)

• And the inverse Discrete Fourier Transform…

Page 13: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.

Power spectrum

• A faster algorithm, the Fast Fourier Transform (FFT), is normally computed, for example, in LabVIEW or MATLAB or in the math feature of the HP 54622A digital scope.

• Power spectrum: The HH(jw) are usually complex numbers, and their magnitudes must be taken to find the Power Spectrum (in Matlab, abs(HH))

Page 14: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.

FFT solves a slightly different problem…

• If resolution is ∆f then the FFT stops at Fsamp/2- ∆f which makes sense, since what exactly happens at Fsamp/2 itself?

• Convert FFT results to Fourier Series coeff:An = real( FFT(n+1) ) * (2/Nsamp)Bn = -imag( FFT(n+1) ) * (2/Nsamp)

Page 15: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.

Aliased frequencies

• Frequencies above the half the sampling rate become aliased as lower frequencies.

• For frequencies just above half the sampling rate, up to the sampling rate, the aliased frequency falias = fnyq-|factual - fnyq|, a kind of mirror-image result.

• Matlab example (work\jdd\alias03.m) • 12 Hz sinewave requires greater than 24 Hz sampling

rate to preserve correct frequency in reconstruction.

• Result of sampling 12 Hz at 20 Hz: alias freq = 10- abs(12-10) = 8 Hz.

Page 16: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.
Page 17: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.

What happens when f_actual = f_sample?

…a triangle wave that is zero at each multiple of f_samp

Lab 6-type question: What is the alias of a 97KHz sinewave sampled at 20KHz? What about 83KHz?

Page 18: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.

Another try at a formula for aliased frequencywhere fsamp = 40 and fact = 108

Fsamp = 40Fact = 108frac = rem(Fact, Fsamp) BB = floor(frac/( Fsamp/2) ) fobs = frac + BB * (Fsamp - 2*frac)

Page 19: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.

Strobe light demo• For Mech Engineers, goal is to find “zero

frequency” and discover angular speed of rotating machinery.

tedkinsman.photoshelter.com

Page 20: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.

About the strobe: General Radio 1531A, from 1971. The circuit used to drive the 10 microseconds ON of the Xenon flash tube is similar to a defibrillator: Charging a capacitor up to several hundred volts. Why no new strobe models on the market? Fear of lawsuits about epilepsy, or the high voltage?

Page 21: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.

Filtering before and after A→D conversion

• Before A→D is the anti-aliasing LP filter• After: Digital (software) filtering available: • ENGN2530: Prof Silverman: Dig. Sig. Proc. • Tapped delay line: calculate “b” coefficients:

Page 22: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.

Windows to <weight> a sample of points (or filter coefficients)

• A window is vector that weights point-for-point (dot product) part of a sequence of data; outside the window the sequence is set to zero.

• Rectangular window• Cosine, Hann, Hamming windows• For dealing with time-sample sequence that

doesn’t start and end at the same value• http://en.wikipedia.org/wiki/Window_function#Cosine_window

Page 23: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.
Page 24: Sampling Theorem, frequency resolution & Aliasing The Sampling Theorem will be the single most important constraint you'll learn in computer-aided instrumentation.

LP anti-aliasinganalog

filter

A-D conversion

Hammingwindow

Hammingwindow

DFTsignal

sample rate

number of samples

Spectrum