0% found this document useful (0 votes)
8 views12 pages

SDA12 Systems

Uploaded by

krittpooomdamr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views12 pages

SDA12 Systems

Uploaded by

krittpooomdamr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Signal & Data Analysis in Neuroscience

2024
Systems

Izhar Bar-Gad
Room: 408 Phone: 7141 Email: [email protected]

Outline – Frequency Domain

 Introduction
 Fourier Transform
 Sampling Theory

 Systems

 Filters

 Spectral Analysis

System definition

 Any manipulation of a signal can thought of as


passing the signal through a system (H):

x(t) y(t)
H
input output

Examples:
d( )
( )2 ( )+a a*( )
dt

X[n-1] 2X[n-1] – 3X[n-2]


delay combined

1
3
Common systems

x1[n] y[n] = x1[n] + x2[n] x1[n] y[n] = x1[n] * x2[n]


+ *
x2[n] x2[n]

x[n] y[n] = x[n] + y[n-1]


+
delay
y[n-1] y[n]

Linear Systems

 Consider a system L. Suppose the response of the


system to inputs x1 is y1 and to input x2 is y2

x1 y1 x2 y2
L L
 The system is linear iff:
for every x1,x2,a,b ax1+bx2  ay1+by2

ax1+bx2 ay1+by2
L
 Example of a linear system : y[n] = 2x[n]
 Example of a nonlinear system: y[n] = (x[n])2

iff  if and only if

Checking Linearity

2 Taken from: http://www.ecse.rpi.edu/

6
Time Invariant (TI) systems

System is constant in time : Whether we apply


an input to the system, now or τ seconds from
now, the output will be identical, except a time
delay of the τ seconds
now x(t) y(t)
T
τ seconds x(t+τ) y(t+τ)
from now T
Example of a time invariant system : y[n] = 2*x[n]
Example of a time varying system : y[n] = n*x[n]

Checking TI

Taken from: http://www.ecse.rpi.edu/

Linear time invariant (LTI) systems

 LTI  both linear and time invariant

 Can be represented by a series of N


coefficients h[n] 0 such that:
N 1

y[n] = h[0]x[n] + h[1]x[n-1] + h[2]x[n-2] +…

 It therefore performs the convolution of the


signal with the systems’ coefficients:

y[ n ]  x[ n ]* h[ n ]  
k 
x[ k ]h[ n  k ]
3
9
Rectangular convolution

2 2
signal  sin( t )  sin(10* t)
1000 1000
2

1 . 5

0 . 5

- 0 . 5

- 1

- 1 . 5

- 2
0 5 0 0 1 0 0 0 1 5 0 0 2 0 0 0 2 5 0 0 3 0 0 0 3 5 0 0 4 0 0 0 4 5 0 0 5 0 0 0

Convolution with a rectangular window


result = conv(ones(1,100), signal)
1 0 0

8 0

6 0

4 0

2 0

- 2 0

- 4 0

- 6 0

- 8 0

- 1 0 0
0 5 0 0 1 0 0 0 1 5 0 0 2 0 0 0 2 5 0 0 3 0 0 0 3 5 0 0 4 0 0 0 4 5 0 0 5 0 0 0

10

Fourier Transform
2 100

80
1.5
60
1
40
0.5
20

0 0

-20
-0.5
-40

Convolution
-1
-60
-1.5
-80

-2 -100
0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000

Time (ms) Time (ms)


4
x 10
4.5 4

4
3.5

3.5
3
3
2.5
2.5
2
2

1.5
1.5

1
1

0.5 0.5

0 0
0 2 4 6 8 10 12 14 16 18 20 0 2 4 6 8 10 12 14 16 18 20

Frequency (Hz) Frequency (Hz)

11

Time vs. Frequency domains

Fourier Fourier
Fourier

X(ω) H(ω) Y(ω)=H(ω)·X(ω)

4
12
Shift theorem

DFTk(x[n-Δ]) =

13

Convolution

DFTk(x*h) =

= X[k]H[k]

14

Time and frequency domains

Time domain Frequency Domain


• x[n], x(t) • X[k], X(ω)

• h[n], h(t) • H[k], H(ω)


• convolution • multiplication

IMPORTANT
• All real systems are in the time domain!!!!
• No frequency domain systems exist.
5 • We just utilize frequency domain for our convenience

15
Impulse response

All LTI systems can be characterized entirely


by a single function called the system's
impulse response
y[ n ]  x[ n ]* h[ n ]
x[ n ]   [ n ]

y[ n]   [n]* h[n]    [k ]h[n  k ]  h[n]
k 

Richard Baraniuk, cnx.org

16

Transfer function

Equivalently, an LTI system can be characterized in


the frequency domain by the transfer function H(ω):

 The relation between the input and output


Y()
H() 
X()
 and also, the transform of the system's impulse
response H ( )  F ( h[n])

 Note: Throughout the slides we’ll mix [ ] and ( )


and indexes but in all the following slides we’ll
deal with the discrete case i.e. DFT

17

FIR and IIR Systems

Systems can be divided into 2 groups,


characterized by their impulse response function

FIR IIR
Finite Impulse Response Infinite Impulse Response

h[n]

M . h[ n] n M
0

p   p  
H    H   
1 q  
6
18
LTI Systems –
General Representation

Since h[n] in a LTI system are scalars, the


system can be described by the linear
constant coefficients difference equation:

19

FIR Systems

 System order = number of coefficients (P)


 “Moving Average” like – convolution of signal
with window

20

FIR implementation

delay delay delay delay

7
21
FIR example

n x(n) y(n)
Average of x(n) over last
5 samples
1 10 2
2 22 6.4
3 24 11.2
4 42 19.6
5 37 27
6 77 40.4
7 89 53.8
8 22 53.4
9 63 57.6
10 9 52

22

FIR example II

Observations:
1) There is a delay between input and output sequences
2) The output is more smooth as compared to the input
3) If the input goes to zero then the output follows suit after some time

23

IIR systems

 Involves a feedback system (memory)


 perturbations at the input could, depending
upon the design, cause unstability (yinf) and
oscillations
 Require far fewer multiplications than FIR
systems, to achieve similar response

8
24
IIR implementation

d = delay

d d

d d

d d

d d

25

Recursive (IIR) system - example

y(n) = x(n) + y(n-1)  y(n)=x(n)+x(n-1)+x(n-2)+…+x(0)

Recursive definition  Infinite output response


What happens if x(0)=1 and x(n>1)=0 ???

26

IIR – exploding example

n x(n) y(n) = x(n) + 2y(n-1)


-6 0 0
-5 0 0
-4 0 0
-3 0 0
-2 0 0
-1 0 0
0 1 1
1 0 2
2 0 4
3 0 8
4 0 16
5 0 32
6 0 64
7 0 128
9
27
IIR – oscillating example

n x(n) y(n) = x(n) + -y(n-1)

-6 0 0
-5 0 0
-4 0 0
-3 0 0
-2 0 0
-1 0 0
0 1 1
1 0 -1
2 0 1
3 0 -1
4 0 1
5 0 -1
6 0 1
7 0 -1

28

Example – Averaging 5 last inputs

 No feedback (FIR) ?

 With feedback (IIR) ?

29

FIR averaging

n x[n] 1 1 1 1 1
y[n] = x[n] + x(n-1)+ x(n-2)+ x(n-3)+ x(n-4)
5 5 5 5 5
-6 0 0
-5 0 0
-4 0 0
-3 0 0
-2 0 0
-1 0 0
0 1 1/5
1 0 1/5
2 0 1/5
3 0 1/5
4 0 1/5
5 0 0
6 0 0

10
30
IIR averaging

1 1
n x(n) y(n) = x(n) + y(n-1)- x(n-5)
5 5
-6 0 0
-5 0 0
-4 0 0
-3 0 0
-2 0 0
-1 0 0
0 1 1/5
1 0 1/5
2 0 1/5
3 0 1/5
4 0 1/5
5 0 0
6 0 0

31

System’s Response

 Response both in Amplitude and Phase

 Amplitude response usually measured


logarithmically – in dB units

 Every LTI system, H ( )  A( )ei ( ) ,has the


effect of delaying each sinusoidal component
by :  ( )

 System’s respose is presented either in log


scale (Bode) or semi-log scale

32

Decibel (dB)
10

 The decibel (dB) is a measure of the ratio


between two quantities:

 −3 dB = ½ power  difference of ±3 dB is
roughly double/half power (actually 1.995).

11
33
Bode Plot (fully logarithmic)

Bode Diagram
8
H(ω)
7

Magnitude (dB)
6

4
180

178

Phase (deg)
176

174

172

170
-2 -1 0 1
10 10 10 10
Frequency (rad/sec)

34

Frequency normalization

 During the analysis of sampled signals it is


convenient in many cases to look at the
frequencies over the range of 2π.

2  f

fs

 As 2fmax<fs  ω≤π (remember Nyquist)

35

Semi-Log plot

H(ω) 50
Magnitude (dB)

-50

-100

-150
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)

5000
Phase (degrees)

-5000

-10000

-15000
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

12 matlab: freqz
Normalized Frequency ( rad/sample)

36

You might also like