17-Jan-15
1
17-Jan-15 HR Spring 2015 1
1Basics
DSP Basics
Chapter 1
ME-4701
Digital Signal Processing
Elective
Spring 2015
SZABIST, Karachi
17-Jan-15 HR Spring 2015 2
1Basics
17-Jan-15
2
Instructor:
Engr. Humera Rafique
Assistant Professor (Mechatronics)
Office: FR-404 (100 Campus )
Course Support
Official: ZABdesk
17-Jan-15 HR Spring 2015 3
1Basics
Chapter Contents
1. Introduction
2. Signals and Systems
3. Types of Signals
4. Types of Systems
17-Jan-15 HR Spring 2015 4
17-Jan-15
3
Introduction to Signal
Processing
17-Jan-15 HR Spring 2015 5
1Basics
Introduction
System
input output
Excitation Response
signals
Signals and Systems:
17-Jan-15 HR Spring 2015 6
1Basics
17-Jan-15
4
Introduction
Signal:
An entity, a pattern of variations, that carries or translates some information
Input, a stimulus, an excitation to a system or process
Response to a system or process
e.g., electrical pulses, sine wave, audio signal, video signal, TV broadcast etc.
Representation of Signals:
Graphical
Mathematical
Physical
17-Jan-15 HR Spring 2015 7
1Basics
Introduction
0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Time
Amplitu
de
2
17-Jan-15 HR Spring 2015 8
1Basics
17-Jan-15
5
Introduction%% DSP lecture Support
% Chapter 1: Introduction to Signal Processing
% Article: Signals and Systems
% grpahical representation
fs = 8000; dt=1/fs; t = 0:dt:1; f= 500;
x = sin(2*pi*f*t); % mathematical representation
plot(t,x), axis([0 0.02 -1 1]),grid, xlabel('Time'), ylabel('Amplitude')
% physical interpretation
wavplay(x,fs)
% saving audio for playback
wavwrite(x,fs,'H:\Fall 13\DSP\MatlabSupp\sinsound')
17-Jan-15 HR Spring 2015 9
1Basics
Introduction
System:
An electrical/physical unit, comprising of a component, device or a complex
small or large network, capable of processing an input signal to a response
System Components:
1. Excitation (input) x(t)
2. Process (system kernel) h(t)
3. Response (output) y(t)
h(t)
x(t) y(t)
17-Jan-15 HR Spring 2015 10
1Basics
17-Jan-15
6
Introduction
Time domain
Frequency domain
Domain of Signals and Systems:
sin 2
X 24
syms t f;
y = sin(2*pi*f*t);
Y = laplace(y)
pretty(Y)
Graphical
Mathematical
Physical
Signals are represented as a function of one or more variables
17-Jan-15 HR Spring 2015 11
1Basics
Introduction
Spatial domain
Time-Frequency: Spectrogram
(Hz/Sec)
Domain of Signals and Systems:
Graphical
Mathematical
19 20 21 22 23 24
7.5
8
8.5
9
9.5
10
10.5
11
11.5
12
12.5
17-Jan-15 HR Spring 2015 12
1Basics
17-Jan-15
7
Types of Signals
17-Jan-15 HR Spring 2015 13
1Basics
Signal Types
Signal Classifications:
1. Periodic/Non Periodic signals
2. Continuous time/Discrete time signals
3. Analog/Digital signals
4. Causal/Non-Causal/Anti-Causal signals
5. Even/Odd signals
6. Finite length/Infinite length signals
7. Deterministic/Random signals
8. Real / Complex valued
9. Power and Energy signals
17-Jan-15 HR Spring 2015 14
1Basics
17-Jan-15
8
Signal Types
1. Periodic/Non Periodic signals:
0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Time
Ampl
itude
T = 0:1/50E3:10E-3;
D = [0:1/1E3:10E-3;0.8.^(0:10)]';
Y = pulstran(T,D,'gauspuls',10E3,0.5);
plot(T,Y), xlabel('Time'), ylabel('Amplitude')
0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Time
Ampl
itude
fs = 10000; dt = 1/fs; t = 0:dt:1; f = 200;
x = square(2*pi*f*t);
plot(t,x,'.-m','MarkerSize',2), a = size(x); b = zeros(1,a);
axis([0 0.02 -1.1 1.1]), xlabel('Time'), ylabel('Amplitude')
hold, plot(t,b,'-.k'),axis([0 0.02 -1.1 1.1]) % for horizontal axis line
17-Jan-15 HR Spring 2015 15
1Basics
Signal Types
1. Periodic/Non Periodic signals:
% Dirichlet Function
x = linspace(0,4*pi,300);
plot(x,diric(x,7)); axis tight; title(' Dirichlet Function')
xlabel('Time'), ylabel('Amplitude')
0 2 4 6 8 10 12-0.2
0
0.2
0.4
0.6
0.8
Dirichlet Function
Time
Ampl
itude
-5 -4 -3 -2 -1 0 1 2 3 4 5-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
t
x(t)
Sinc
%% sinc
x = linspace(-5,5); y = sinc(x); % plot(x,y), xlabel('Time'), ylabel('Amplitude')
a = length(x)-1; t = -a/2:a/2;
plot (x,y,'LineWidth',1), xlabel('t'), ylabel('x(t)'), title('Sinc'), hold,
plot(zeros(1,a+1)',t,'-.k') % for vertical axis line
plot(t,zeros(1,a+1)','--k') % for horizontal axis line
axis([-5 5 -0.4 1.1])
17-Jan-15 HR Spring 2015 16
1Basics
17-Jan-15
9
Signal Types
2. Continuous Time/Discrete Time signals:
!"#Discretized time axis
Continuous-time signal x(t), the
independent variable, t is exist at
every instant of time
The signal itself needs not to be
continuous
A Discrete-time signal defined only at
discrete instances
Thus, the independent variable t has
discrete values only
0 0.002 0.004 0.006 0.008 0.01-1
-0.5
0
0.5
1
Time
Ampl
itude
0 0.002 0.004 0.006 0.008 0.01-1
-0.5
0
0.5
1
Time
DT Am
plitu
de
sin2
17-Jan-15 HR Spring 2015 17
1Basics
Signal Types
2. Continuous Time/Discrete Time signals:
%% continuous and discrete signals
fs = 8000; dt = 1/fs; t = 0:dt:1; f = 500;
x = sin(2*pi*f*t);
subplot(211), plot(t,x)
axis([0 0.01 -1 1]),grid
xlabel('Time')
ylabel('Amplitude')
subplot(212)
stem(t,x,'g','filled')
axis([0 0.01 -1 1]),grid
xlabel('Time')
ylabel('DT Amplitude')
0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01-1
-0.5
0
0.5
1
Time
Ampl
itude
0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01-1
-0.5
0
0.5
1
Time
DT Am
plitu
de
17-Jan-15 HR Spring 2015 18
1Basics
17-Jan-15
10
Signal Types
3. Analog /Digital signals:
Discretized amplitude axis
undiscretized time axis: : Piecewise
continuous time signal
Discretized amplitude axis
Discretized time axis
17-Jan-15 HR Spring 2015 19
1Basics
Signal Types4. Causal /Anti causal/Non-Causal signals:
Causal:
0 % 0
17-Jan-15 HR Spring 2015 20
1Basics
17-Jan-15
11
Signal Types4. Causal /Anti causal/Non-Causal signals:
Anti-Causal: 0 & 0
17-Jan-15 HR Spring 2015 21
1Basics
Signal Types4. Causal /Anti causal/Non-Causal signals:
Non-Causal:
0'()**+ & 0, % 0
17-Jan-15 HR Spring 2015 22
1Basics
17-Jan-15
12
Signal Types
5. Even/Odd signals:
-An even signal is symmetric around the vertical axis
-5 -4 -3 -2 -1 0 1 2 3 4 5-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Time
Ampl
itude
-10 -5 0 5 10
0
0.2
0.4
0.6
0.8
1
t
x(t)
Even Signal
x = [ zeros(1,10) ones(1,5) zeros(1,10)];
a = length(x)-1; t = -a/2:a/2;
plot (t,x,'c','LineWidth',2), axis([-12 12 -0.1 1.1]), xlabel('t'), ylabel('x(t)'), title('Even Signal')
hold, plot(zeros(1,a+1)',t,'-.k') % for vertical axis line
plot(t,zeros(1,a+1)','--k') % for horizontal axis line
17-Jan-15 HR Spring 2015 23
1Basics
Signal Types
5. Even/Odd signals:
--An odd signal is symmetric around the horizontal axis
-4000 -3000 -2000 -1000 0 1000 2000 3000 4000-4
-3
-2
-1
0
1
2
3
4
t
x(t)
Odd Signal
-
--%% oddfs = 8000; dt = 1/fs; t = 0:dt:1; f = 500;
x = sin(2*pi*f*t);
a = length(x)-1; t = -a/2:a/2; plot(t,angle(fft(x))), grid
xlabel('t'), ylabel('x(t)'), title('Odd Signal')
17-Jan-15 HR Spring 2015 24
1Basics
17-Jan-15
13
Signal Types6. Finite Length / Infinite Length signals:
Finite length:
0 50 100 150 200 250 300-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Time
Amplitu
de
17-Jan-15 HR Spring 2015 25
1Basics
Signal Types6. Finite Length / Infinite Length signals:
Infinite length:
0 0.005 0.01 0.015 0.02 0.025 0.03-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
. . . . . . .. . . . . . .
17-Jan-15 HR Spring 2015 26
1Basics
17-Jan-15
14
Signal Types
7. Real/Complex Valued signals:
| | Real valued:
12 Complex valued:
| | 2
34 56 2
17-Jan-15 HR Spring 2015 27
1Basics
Signal Types
8. Deterministic / Random signals:
3 *589 Deterministic signal that can be represented by an equation, formula or table Future values are predictable
Linear signals
Random signals whose representation is not possible
to by a usual mathematical equation, formula or table
Thus, future values are not predictable (a statistical
procedure can work)
Non-linear, stochastic or un-deterministic signals
5 10 15 20 25 30 35 40 45 50
-1.5
-1
-0.5
0
0.5
1
1.5
2
2.5Random Signal
Time
Ampl
itude
17-Jan-15 HR Spring 2015 28
1Basics
17-Jan-15
15
Signal Types
8. Deterministic / Random signals:
5 10 15 20 25 30 35 40 45 50-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
2.5
Random Signal
Time
Ampl
itude
%% random signal
x = randn(1,50);
plot(x), grid, axis tight;
title('Random Signal'),
xlabel('Time'), ylabel('Amplitude')
5 10 15 20 25 30 35 40 45 50-2
-1.5
-1
-0.5
0
0.5
1
1.5
Random Signal
Time
Ampl
itude
5 10 15 20 25 30 35 40 45 50
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2Random Signal
Time
Ampl
itude
17-Jan-15 HR Spring 2015 29
1Basics
Signal Types
9. Power / Energy signals:
: lim=>1
2@ 1 A =
BC5=
Energy of a Signal:
D A >
BC5>
Power of a Signal:
* E | |,F
5F
) limF>12E | |,
F
5F
17-Jan-15 HR Spring 2015 30
1Basics
17-Jan-15
16
Signal Types
9. Power / Energy signals:
Energy Signal:
Power Signal:
)G* 0; **I+ *
)G* *; **I+ 0
All the periodic signals are power signals, but
Not all non-periodic signals are energy signals
17-Jan-15 HR Spring 2015 31
1Basics
Signal Types
9. Power / Energy signals:
Example 1-1:
Find out if the signal is energy, power or neither?
x(t)
t
3
1
0
x(n)
n
0
1 2
17-Jan-15 HR Spring 2015 32
1Basics
17-Jan-15
17
Signal Types
9. Power / Energy signals:
Example 1-2: Find out if the signal is energy, power or neither?
3 sin 2 - J J
17-Jan-15 HR Spring 2015 33
1Basics
Types of Systems
17-Jan-15 HR Spring 2015 34
1Basics
17-Jan-15
18
System Types
System Classifications:
1. Continuous time/Discrete time systems
2. Analog/Digital systems
3. Linear/Non-linear systems
4. Time variant/ Time-invariant systems
5. Causal/Non-causal systems
6. Open loop/Closed loop systems
7. Stable/Unstable systems
8. Static /Dynamic Systems
17-Jan-15 HR Spring 2015 35
1Basics
System Types
Continuous /Discrete Systems:
Continuous Time
System
Discrete Time
System
17-Jan-15 HR Spring 2015 36
1Basics
17-Jan-15
19
System Types
Analog/Digital Systems:
Analog System
Digital System111011110001. . . . . . . . 101010010001. . . . . . . .
17-Jan-15 HR Spring 2015 37
1Basics
System Types
Linear/Non-Linear Systems:
Linear System6 +
Linear System
6 +
+6 +
Linear System +
17-Jan-15 HR Spring 2015 38
1Basics
17-Jan-15
20
System Types
Time Variant/Time Invariant Systems:
Time inVariant
6 +
6 - L + - L
Time Variant
6 +
6 - L + - L
17-Jan-15 HR Spring 2015 39
1Basics
System Types
Causal / Non-causal Systems:
Causal: A system whose, output depends on current and past inputs, no contribution from the future
inputs
Real time systems
+ - 2
+ 2
Non-Causal: A system whose, output depends on future and past inputs
17-Jan-15 HR Spring 2015 40
1Basics
17-Jan-15
21
System Types
Open Loop / Closed Loop Systems:
+ - 2
+ 2 - + - 1
Open Loop System6 +
Closed Loop System6 +
17-Jan-15 HR Spring 2015 41
1Basics
System Types
Stable / Unstable Systems:
Stable System6 stableinput + 2*S)S
Unstable System6 stableinput +6 S2*S)S
17-Jan-15 HR Spring 2015 42
1Basics
17-Jan-15
22
System Types
Static / Dynamic Systems:
Static Systems: Constant system, whose parameters do not change
Memoryless systems (i.e., No feedback element)
e.g., constant target shooting system
Dynamic Systems: whose parameters change
Memory based systems
e.g., human body, missile system that tracks moving target
+ 6 - 2
+ 6+ 2+ 6+ - 217-Jan-15 HR Spring 2015 43
1Basics
Reference
1. Proakis
2. Orfanidis
3. Mathworks Manual: Signal processing toolbox
17-Jan-15 HR Spring 2015 44
1Basics