Docsity

Prof. Paris: Sampling, LTI Systems, and FIR Filters - Prof. Bernd-Peter Paris, Study notes of Electrical and Electronics Engineering

Partial preview of the text

Download Prof. Paris: Sampling, LTI Systems, and FIR Filters - Prof. Bernd-Peter Paris and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

ECE 201: Introduction to Signal Analysis

Prof. Paris

Last updated: October 31, 2007

Introduction to Sampling Systems Linear, Time-invariant Systems Convolution and Linear, Time-invariant Systems Implementation of FIR Systems

Part I

Sampling of Signals

Introduction to Sampling Systems Linear, Time-invariant Systems Convolution and Linear, Time-invariant Systems Implementation of FIR Systems

Sampled Signals in MATLAB Example: Three Sinuoids The Influence of the Sampling Rate The Sampling Theorem Reconstructing a Signal from Samples

Sampling and Discrete-Time Signals

MATLAB, and other digital processing systems, can not

process continuous-time signals.

Instead, MATLAB requires the continuous-time signal to be

converted into a discrete-time signal.

The conversion process is called sampling.

To sample a continuous-time signal, we evaluate it at a

discrete set of times tn = nTs, where

n is a integer,

Ts is called the sampling period (time between samples),

fs = 1 /Ts is the sampling rate (samples per second).

Introduction to Sampling Systems Linear, Time-invariant Systems Convolution and Linear, Time-invariant Systems Implementation of FIR Systems

Sampled Signals in MATLAB Example: Three Sinuoids The Influence of the Sampling Rate The Sampling Theorem Reconstructing a Signal from Samples

Sampling and Discrete-Time Signals

Sampling results in a sequence of samples

x(nTs) = A · cos( 2 πfnTs + φ).

Note that the independent variable is now n, not t.

To emphasize that this is a discrete-time signal, we write

x[n] = A · cos( 2 πfnTs + φ).

Sampling is a straightforward operation.

We will see that the sampling rate fs must be chosen with

care!

Introduction to Sampling Systems Linear, Time-invariant Systems Convolution and Linear, Time-invariant Systems Implementation of FIR Systems

Sampled Signals in MATLAB Example: Three Sinuoids The Influence of the Sampling Rate The Sampling Theorem Reconstructing a Signal from Samples

Example: Three Sinuoids

Objective: In MATLAB, compute sampled versions of

three sinusoids:

1 x(t) = cos( 2 πt + π/ 4 )

2 x(t) = cos( 2 π 9 t − π/ 4 )

3 x(t) = cos( 2 π 11 t + π/ 4 )

The sampling rate for all three signals is fs = 10.

Introduction to Sampling Systems Linear, Time-invariant Systems Convolution and Linear, Time-invariant Systems Implementation of FIR Systems

Sampled Signals in MATLAB Example: Three Sinuoids The Influence of the Sampling Rate The Sampling Theorem Reconstructing a Signal from Samples

MATLAB code

% SamplingDemo − Sample t h r e e s i n u s o i d a l s i g n a l s t o demonstrate th e impact % o f sampling

f s = 10 ; dur = 10 ;

t t = 0 : 1 / f s : dur ; xx1 = cos (2∗ p i ∗ t t + p i / 4 ) ; xx2 = cos (2∗ p i ∗ 9 ∗ t t − p i / 4 ) ; xx3 = cos (2∗ p i ∗ 11 ∗ t t + p i / 4 ) ;

p l o t ( t t , xx1 , ’ : o ’ , t t , xx2 , ’ : x ’ , t t , xx3 , ’ : + ’ ) ; gri d x l a b e l ( ’ Time ( s ) ’ )

Introduction to Sampling Systems Linear, Time-invariant Systems Convolution and Linear, Time-invariant Systems Implementation of FIR Systems

Sampled Signals in MATLAB Example: Three Sinuoids The Influence of the Sampling Rate The Sampling Theorem Reconstructing a Signal from Samples

What happened?

The samples for all three signals are identical: how is that

possible?

Is there a “bug” in the MATLAB code?

No, the code is correct.

Suspicion: The problem is related to our choice of

sampling rate.

To test this suspicion, repeat the experiment with a different

sampling rate.

We also reduce the duration to keep the number of samples

constant - that keeps the plots reasonable.

Introduction to Sampling Systems Linear, Time-invariant Systems Convolution and Linear, Time-invariant Systems Implementation of FIR Systems

Sampled Signals in MATLAB Example: Three Sinuoids The Influence of the Sampling Rate The Sampling Theorem Reconstructing a Signal from Samples

MATLAB code

% SamplingDemoHigh − Sample t h r e e s i n u s o i d a l s i g n a l s t o demonstrate th e impact % o f sampling

f s = 100; dur = 1 ;

t t = 0 : 1 / f s : dur ; xx1 = cos (2∗ p i ∗ t t + p i / 4 ) ; xx2 = cos (2∗ p i ∗ 9 ∗ t t − p i / 4 ) ; xx3 = cos (2∗ p i ∗ 11 ∗ t t + p i / 4 ) ;

p l o t ( t t , xx1 , ’−∗ ’ , t t , xx2 , ’−x ’ , t t , xx3 , ’−+ ’ ) ; hold on p l o t ( t t ( 1 : 1 0 : end ) , xx1 ( 1 : 1 0 : end ) , ’ ok ’ ) ; gri d x l a b e l ( ’ Time ( s ) ’ )

hold o f f

Introduction to Sampling Systems Linear, Time-invariant Systems Convolution and Linear, Time-invariant Systems Implementation of FIR Systems

Sampled Signals in MATLAB Example: Three Sinuoids The Influence of the Sampling Rate The Sampling Theorem Reconstructing a Signal from Samples

The Influence of the Sampling Rate

Now the three sinusoids are clearly distinguishable and

lead to different samples.

Since the only parameter we changed is the sampling rate

fs, it must be responsible for the ambiguity in the first plot.

Notice also that every 10-th sample (marked with a black

circle) is identical for all three sinusoids.

Since the sampling rate was 10 times higher for the second

plot, this explains the first plot.

It is useful to investigate the effect of sampling

mathematically, to understand better what impact it has.

Introduction to Sampling Systems Linear, Time-invariant Systems Convolution and Linear, Time-invariant Systems Implementation of FIR Systems

Sampled Signals in MATLAB Example: Three Sinuoids The Influence of the Sampling Rate The Sampling Theorem Reconstructing a Signal from Samples

Sampling a Sinusoidal Signal

A continuous-time sinusoid is given by

x(t) = A cos( 2 πft + φ).

When this signal is sampled at rate fs, we obtain the

discrete-time signal

x[n] = A cos( 2 πfn/fs + φ).

It is useful to define the normalized frequency fd =

f

fs , so

that

x[n] = A cos( 2 πfd n + φ).

Introduction to Sampling Systems Linear, Time-invariant Systems Convolution and Linear, Time-invariant Systems Implementation of FIR Systems

Sampled Signals in MATLAB Example: Three Sinuoids The Influence of the Sampling Rate The Sampling Theorem Reconstructing a Signal from Samples

Oversampling

When the sampling rate is such that 0 ≤ fd ≤ 1 /2, then the

samples of the sinusoidal signal are given by

x[n] = A cos( 2 πfd n + φ).

This cannot be simplified further.

It provides our base-line.

Oversampling is the desired behaviour!

Introduction to Sampling Systems Linear, Time-invariant Systems Convolution and Linear, Time-invariant Systems Implementation of FIR Systems

Sampled Signals in MATLAB Example: Three Sinuoids The Influence of the Sampling Rate The Sampling Theorem Reconstructing a Signal from Samples

Undersampling, Aliasing

When the sampling rate is such that 1 < fd ≤ 3 /2, then we

define the apparent frequency fa = fd − 1.

Notice that 0 < fa ≤ 1 /2.

For f = 11 , fs = 10 ⇒ fd = 11 / 10 ⇒ fa = 1 / 10.

The samples of the sinusoidal signal are given by

x[n] = A cos( 2 πfd n + φ) = A cos( 2 π( 1 + fa)n + φ).

Expanding the terms inside the cosine,

x[n] = A cos( 2 πfan + 2 πn + φ) = A cos( 2 πfan + φ)

Interpretation: The samples are identical to those from a

sinusoid with frequency fa · fs and phase φ.

Introduction to Sampling Systems Linear, Time-invariant Systems Convolution and Linear, Time-invariant Systems Implementation of FIR Systems

Sampled Signals in MATLAB Example: Three Sinuoids The Influence of the Sampling Rate The Sampling Theorem Reconstructing a Signal from Samples

Sampling Higher-Frequency Sinusoids

For sinusoids of even higher frequencies f , either folding or

aliasing occurs.

As before, let fd be the normalized frequency f /fs.

Decompose fd into an integer part N and fractional part fp.

Example: If fd is 5.7 then N equals 5 and fp is 0.7.

Notice that 0 ≤ fp < 1, always.

Phase Reversal occurs when the phase of the sampled

sinusoid is the negative of the phase of the

continuous-time sinusoid.

We distinguish between

Folding occurs when fp > 1 /2. Then the apparent

frequency fa equals 1 − fp and phase reversal occurs.

Aliasing occurs when fp ≤ 1 /2. Then the apparent

frequency is fa = fp; no phase reversal occurs.

Introduction to Sampling Systems Linear, Time-invariant Systems Convolution and Linear, Time-invariant Systems Implementation of FIR Systems

Sampled Signals in MATLAB Example: Three Sinuoids The Influence of the Sampling Rate The Sampling Theorem Reconstructing a Signal from Samples

Examples

For the three sinusoids considered earlier:

1 f = 1 , φ = π/ 4 , f

s =^10 ⇒^ fd =^1 /^10

2 f = 9 , φ = −π/ 4 , f

s =^10 ⇒^ fd =^9 /^10

3 f = 11 , φ = π/ 4 , f

s =^10 ⇒^ fd =^11 /^10

The first case, represents oversampling: The apparent

frequency fa = fd and no phase reversal occurs.

The second case, represents folding: The apparent fa

equals 1 − fd and phase reversal occurs.

In the final example, the fractional part of fd = 1 /10.

Hence, this case represents alising; no phase reversal

occurs.