Lecture 2
Lecture 2
2
1
2
1
) (
1 1
) (
1
2
1 2 1 2
t
t
t
t
dt t v
R t t
dt t p
t t
EE-2027 SaS, L2 5/25
Generic Signal Energy and Power
Total energy of a continuous signal x(t) over [t
1
, t
2
] is:
where |.| denote the magnitude of the (complex) number.
Similarly for a discrete time signal x[n] over [n
1
, n
2
]:
By dividing the quantities by (t
2
-t
1
) and (n
2
-n
1
+1),
respectively, gives the average power, P
Note that these are similar to the electrical analogies
(voltage), but they are different, both value and dimension.
}
=
2
1
2
) (
t
t
dt t x E
=
=
2
1
2
] [
n
n n
n x E
EE-2027 SaS, L2 6/25
Energy and Power over Infinite Time
For many signals, were interested in examining the power and energy
over an infinite time interval (-, ). These quantities are therefore
defined by:
If the sums or integrals do not converge, the energy of such a signal is
infinite
Two important (sub)classes of signals
1. Finite total energy (and therefore zero average power)
2. Finite average power (and therefore infinite total energy)
Signal analysis over infinite time, all depends on the tails (limiting
behaviour)
} }
= = dt t x dt t x E
T
T
T
2 2
) ( ) ( lim
= =
= =
n
N
N n
N
n x n x E
2 2
] [ ] [ lim
}
=
T
T
T
dt t x
T
P
2
) (
2
1
lim
=
+
=
N
N n
N
n x
N
P
2
] [
1 2
1
lim
EE-2027 SaS, L2 7/25
Time Shift Signal Transformations
A central concept in signal analysis is the transformation of one
signal into another signal. Of particular interest are simple
transformations that involve a transformation of the time axis only.
A linear time shift signal transformation is given by:
where b represents a signal offset from 0, and the a parameter
represents a signal stretching if |a|>1, compression if 0<|a|<1 and
a reflection if a<0.
) ( ) ( b at x t y + =
EE-2027 SaS, L2 8/25
An important class of signals is the class of periodic
signals. A periodic signal is a continuous time signal
x(t), that has the property
where T>0, for all t.
Examples:
cos(t+2t) = cos(t)
sin(t+2t) = sin(t)
Are both periodic with period 2t
NB for a signal to be periodic, the relationship must hold
for all t.
Periodic Signals
) ( ) ( T t x t x + =
2t
EE-2027 SaS, L2 9/25
An even signal is identical to its time reversed signal, i.e. it
can be reflected in the origin and is equal to the original:
Examples:
x(t) = cos(t)
x(t) = c
An odd signal is identical to its negated, time reversed
signal, i.e. it is equal to the negative reflected signal
Examples:
x(t) = sin(t)
x(t) = t
This is important because any signal can be expressed as
the sum of an odd signal and an even signal.
Odd and Even Signals
) ( ) ( t x t x =
) ( ) ( t x t x =
EE-2027 SaS, L2 10/25
Exponential and Sinusoidal Signals
Exponential and sinusoidal signals are characteristic of real-world
signals and also from a basis (a building block) for other
signals.
A generic complex exponential signal is of the form:
where C and a are, in general, complex numbers. Lets investigate
some special cases of this signal
Real exponential signals
at
Ce t x = ) (
0
0
>
>
C
a
0
0
>
<
C
a
Exponential growth
Exponential decay
EE-2027 SaS, L2 11/25
Periodic Complex Exponential &
Sinusoidal Signals
Consider when a is purely imaginary:
By Eulers relationship, this can be expressed
as:
This is a periodic signals because:
when T=2t/e
0
A closely related signal is the sinusoidal
signal:
We can always use:
t j
Ce t x
0
) (
e
=
t j t e
t j
0 0
sin cos
0
e e
e
+ =
t j
T t j
e t j t
T t j T t e
0
0
0 0
0 0
) (
sin cos
) ( sin ) ( cos
e
e
e e
e e
= + =
+ + + =
+
( ) | e + = t t x
0
cos ) (
0 0
2 f t e =
( ) ( )
( ) ( )
) (
0
) (
0
0
0
sin
cos
| e
| e
| e
| e
+
+
= +
9 = +
t j
t j
e A t A
e A t A
T
0
= 2t/e
0
= t
cos(1)
T
0
is the fundamental
time period
e
0
is the fundamental
frequency
EE-2027 SaS, L2 12/25
Exponential & Sinusoidal Signal Properties
Periodic signals, in particular complex periodic
and sinusoidal signals, have infinite total
energy but finite average power.
Consider energy over one period:
Therefore:
Average power:
Useful to consider harmonic signals
Terminology is consistent with its use in music,
where each frequency is an integer multiple of
a fundamental frequency
0
0
0
2
0
0
0
1 T dt
dt e E
T
T
t j
period
= =
=
}
}
e
1
1
0
= =
period period
E
T
P
=
E
EE-2027 SaS, L2 13/25
General Complex Exponential Signals
So far, considered the real and periodic complex exponential
Now consider when C can be complex. Let us express C is polar form
and a in rectangular form:
So
Using Eulers relation
These are damped sinusoids
0
e
|
j r a
e C C
j
+ =
=
t j rt t j r j at
e e C e e C Ce
) ( ) (
0 0
| e e | + +
= =
) ) sin(( ) ) cos((
0 0
) (
0
t e C j t e C e e C Ce
rt rt t j r j at
| e | e
e |
+ + + = =
+
EE-2027 SaS, L2 14/25
Discrete Unit Impulse and Step Signals
The discrete unit impulse signal is defined:
Useful as a basis for analyzing other signals
The discrete unit step signal is defined:
Note that the unit impulse is the first
difference (derivative) of the step signal
Similarly, the unit step is the running sum
(integral) of the unit impulse.
=
=
= =
0 1
0 0
] [ ] [
n
n
n n x o
>
<
= =
0 1
0 0
] [ ] [
n
n
n u n x
] 1 [ ] [ ] [ = n u n u n o
EE-2027 SaS, L2 15/25
Continuous Unit Impulse and Step Signals
The continuous unit impulse signal is
defined:
Note that it is discontinuous at t=0
The arrow is used to denote area, rather
than actual value
Again, useful for an infinite basis
The continuous unit step signal is defined:
=
=
= =
0
0 0
) ( ) (
t
t
t t x o
}
= =
t
d t u t x t t o ) ( ) ( ) (
>
<
= =
0 1
0 0
) ( ) (
t
t
t u t x
EE-2027 SaS, L2 16/25
Introduction to Matlab
Simulink is a package that runs inside the Matlab environment.
Matlab (Matrix Laboratory) is a dynamic, interpreted, environment
for matrix/vector analysis
User can build programs (in .m files or at command line) C/Java-
like syntax
Ideal environment for programming and analysing discrete
(indexed) signals and systems
EE-2027 SaS, L2 17/25
Basic Matlab Operations
>> % This is a comment, it starts with a %
>> y = 5*3 + 2^2; % simple arithmetic
>> x = [1 2 4 5 6]; % create the vector x
>> x1 = x.^2; % square each element in x
>> E = sum(abs(x).^2); % Calculate signal energy
>> P = E/length(x); % Calculate av signal power
>> x2 = x(1:3); % Select first 3 elements in x
>> z = 1+i; % Create a complex number
>> a = real(z); % Pick off real part
>> b = imag(z); % Pick off imaginary part
>> plot(x); % Plot the vector as a signal
>> t = 0:0.1:100; % Generate sampled time
>> x3=exp(-t).*cos(t); % Generate a discrete signal
>> plot(t, x3, x); % Plot points
EE-2027 SaS, L2 18/25
Other Matlab Programming Structures
Loops
for i=1:100
sum = sum+i;
end
Goes round the for loop 100
times, starting at i=1 and
finishing at i=100
i=1;
while i<=100
sum = sum+i;
i = i+1;
end
Similar, but uses a while loop
instead of a for loop
Decisions
if i==5
a = i*2;
else
a = i*4;
end
Executes whichever branch is
appropriate depending on test
switch i
case 5
a = i*2;
otherwise
a = i*4;
end
Similar, but uses a switch
EE-2027 SaS, L2 19/25
Matlab Help!
These slides have provided a rapid introduction to Matlab
Mastering Matlab 6, Prentice Hall,
Introduction to Matlab (on-line)
Lots of help available
Type help in the command window or help operator. This
displays the help associated with the specified operator/function
Type lookfor topic to search for Matlab commands that are
related to the specified topic
Type helpdesk in the command window or select help on the pull
down menu. This allows you to access several, well-written
programming tutorials.
comp.soft-sys.matlab newsgroup
Learning to program (Matlab) is a bums on seats activity. There is no
substitute for practice, making mistakes, understanding concepts
EE-2027 SaS, L2 20/25
Using the Matlab Debugger
Because Matlab is an interpreted language, there is no compile type
syntax checking and the likelihood of a run-time error is higher
Run-time debugging can help
Use the debug and breakpoints pull-down menus to determine where to
stop program and inspect variables
Step over lines/step into functions to evaluate what happens
EE-2027 SaS, L2 21/25
Introduction to Simulink
Simulink is a graphical, drag and drop environment for
building simple and complex signal and system
dynamic simulations.
It allows users to concentrate on the structure of the
problem, rather than having to worry (too much)
about a programming language.
The parameters of each signal and system block is
configured by the user (right click on block)
Signals and systems are simulated over a particular
time.
EE-2027 SaS, L2 22/25
Signals in Simulink
Two main libraries for manipulating signals in
Simulink:
Sources: generate a signal
Sink: display, read or store a signal
EE-2027 SaS, L2 23/25
Example: Generate and View a Signal
Copy sine wave source and
scope sink onto a new
Simulink work space and
connect.
Set sine wave parameters modify
to 2 rad/sec
Run the simulation:
Simulation - Start
Open the scope and leave open
while you change parameters
(sin or simulation parameters)
and re-run
EE-2027 SaS, L2 24/25
Lecture 2: Summary
This lecture has looked at signals:
Power and energy
Signal transformations
Time shift
Periodic
Even and odd signals
Exponential and sinusoidal signals
Unit impulse and step functions
Matlab and Simulink are complementary environments
for producing and analysing continuous and discrete
signals.
This will require some effort to learn the programming
syntax and style!
EE-2027 SaS, L2 25/25
Lecture 2: Exercises
SaS OW:
Q1.3
Q1.7-1.14
Matlab/Simulink
Try out basic Matlab commands on slide 17
Try creating the sin/scope Simulink simulation on slide
23 and modify the parameters of the sine wave and re-
run the simulation
Learning how to use the help facilities in Matlab is
important - do it!