gg 313 lecture 26 11/29/05 sampling theorem transfer functions

22
GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions

Upload: inga-summers

Post on 03-Jan-2016

42 views

Category:

Documents


0 download

DESCRIPTION

GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions. Homework review: Data are 128 points, 20 samples/sec. What is the time vector that matches the data? Starting at t=0, we want a new point every 1/20=.05 s time=[0:deltat:6.35]; % The last point is at 127*.05 sec. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions

GG 313 Lecture 26

11/29/05

Sampling Theorem

Transfer Functions

Page 2: GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions

Homework review:

Data are 128 points, 20 samples/sec.

What is the time vector that matches the data?

Starting at t=0, we want a new point every 1/20=.05 s

time=[0:deltat:6.35]; % The last point is at 127*.05 sec.

How about the frequency vector?

Our sampling frequency is 20 Hz, so we expect the frequency scale to be symmetric about the middle and for it to go from 0 to the sampling frequency in 128 steps:

freq=[0:1/(N*deltat):1/deltat*(1-1/N)];

Page 3: GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions

Now generate and plot the spectrum:Y=fft(y);p=Y.*conj(Y);plot(freq,p)

Note the symmetry about the Nyquist (10 Hz) and peaks at 1 and 4 Hz. We actually only need to plot the 1st half.

Page 4: GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions

Now we apply a simple filter to the data by convolution:h=[.5 -1 .5];out=conv(h,y);

Now calculate the power spectrum of “out” and compare it to the input to the filter “y”.

OUT=fft(out(2:129));OUTP=OUT.*conj(OUT); plot(freq,OUTP,'r')

But, let’s only plot from zero to the Nyquist:plot(freq(1:65), OUTP(1:65),'r')

Page 5: GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions

The red (filtered) spectrum has lost energy at the low frequencies (attenuated) and gained (amplified) at the high frequencies relative to the input signal. The peak at 1 Hz has been effectively removed.

Page 6: GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions

Now try the other filter:hlp=[.25 .5 .25]; outlp=conv(hlp,y); OUTLP=fft(outlp(2:129)); OUTLPP=OUTLP.*conj(OUTLP); plot(freq(1:65),OUTLPP,'k')

In this case, both peaks are present, but the high frequencies have been attenuated relative to the input signal.

Page 7: GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions

Let’s plot the same data in dB (10*log10(p)):

blue: input

red: [.25 .5 .25]

black: [.25 -.5 .25]

Note that the peaks that look like they had been completely wiped out are actually there - just much smaller. For example the peal at 1 Hz is reduce by ~20 dB by the “black” filter - that’s about a factor of 10 in amplitude.

Page 8: GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions

This is the comb function made up of an infinite string of delta functions separated by T. It’s Fourier Transform is also an infinite string of delta function separated by frequency 1/T:

The sampling theorem

The sampling theorem says that if all the energy in a continuous signal is below the Nyquist frequency, then all the information in that signal is captured in the sampling process.

We can show this by using our last transform pair:

δ t − jT( )j=−∞

∑ = Δ(T ) (5.117)

Page 9: GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions

Consider what happens to a continuous analog signal in the time domain if we MULTIPLY it (NOT convolve) with a comb function.

What we get is a SAMPLE of that function every T. Where T is the sample period.

Page 10: GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions

Now we need to look at the Fourier Transform of each of these functions:

The greens are positive frequencies and oranges negative. As long as the signal is BAND LIMITED to frequencies below the Nyquist (1/2T), ALL of the information is preserved after sampling.

Page 11: GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions

No let’s see what happens if the signal is NOT band limited:

In this case, the signal contains high frequency energy above the Nyquist. This energy shows up in the 0-Nyquist frequency range as a peak of negative frequency energy. The arrow shows where the peak originated.

Page 12: GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions

Transfer Functions

Analysis of time series data often involves determination of how the equipment and processing steps affect the signal as it passes through various steps. For example, a particular sound source will have a particular spectrum, and it will be detected by hydrophones that change the spectrum of the signal in a particular way. These functions must be determined and removed if the characteristics of the “earth filter” are to be determined.

There are many ways to determine these TRANSFER FUNCTIONS. For example, we can make a simple filter from a resistor and a capacitor:

Page 13: GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions

This circuit has a well-known transfer function:

VoutVin

=1

1+ ωRC( )2

Notice that this function is already in the frequency domain, and we can plot it using Matlab:

Page 14: GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions

The slope is -6 dB/octave, and the corner frequency (3dB down point) is 1/(2πRC), and the phase response is =tan-1(1/(RC)

Page 15: GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions

One way to define the transfer function of a system that is not well known is to use an impulse for an input signal. Recall that an impulse convolved with any function yields the function itself. So the output of a system when an impulse is the input is called the IMPULSE RESPONSE.

The Fourier transform of the impulse response yields the transfer function of the system.

Output/Input=Transfer function=FFT(Impulse response)

The impulse response of a Linear Time-Invariant (LTI) system yields all the information about transfer properties that the system performs.

Page 16: GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions

Consider the following function: out(i)=out(i-1)+in(i), where out(i) is the output at time (i) and in(i) is the input.

USE MATLAB to:

1) get the impulse response of this function

2) find its response to a sine wave

in(i)=sin((ii-1)*8*pi*(f/(n*dt)));

f=8;

Notice several things: The impulse response of the function is a step (=0 if ii<0, =1 if ii>=0)

What kind of function is this?

How does the output change as f changes for the sin wave input?

Page 17: GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions

Recall the integral of a sine wave:

sin(ωt)dt = −1

ω∫ cos(ωt)

This says that the output of an integrator should decrease in amplitude by a factor of 2 with each doubling in frequency. That is, an integrator should modify the spectrum by -6dB/octave.

Thus, to integrate a signal, all you need to do it to move it to the frequency domain, subtract 6 dB/octave (with 0 dB at =1) and return to the time domain.

Similarly, to differentiate a signal, ADD 6dB/octave in the frequency domain.

Page 18: GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions
Page 19: GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions
Page 20: GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions
Page 21: GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions
Page 22: GG 313 Lecture 26 11/29/05 Sampling Theorem Transfer Functions

Consider a “perfect” filter in the frequency domain, such a filter passes all energy below a particular frequency and none above. This is a “boxcar”. This is one of our transform pairs, and we know the function in the time domain will be a sinc function: y=sin(x)/x, y=1|x=0.