Signals & System
Signals & System
Lecture 2
Signals Concepts & Properties
2/25
Lecture 2: Resources
SaS, O&W, Sections 1.1-1.4
SaS, H&vV, Sections 1.4-1.9
Mastering Matlab 6
Mastering Simulink 4
3/25
Reminder: Continuous & Discrete Signals
Continuous-Time Signals
Most signals in the real world are
x(t)
continuous time, as the scale is
infinitesimally fine.
E.g. voltage, velocity,
Denote by x(t), where the time
t
interval may be bounded (finite) or
infinite
Discrete-Time Signals
Some real world and many digital
signals are discrete time, as they
are sampled
x[n]
E.g. pixels, daily stock price (anything
that a digital computer processes)
Denote by x[n], where n is an integer
value that varies discretely
n
Sampled continuous signal
x[n] =x(nk)
4/25
Electrical Signal Energy & Power
It is often useful to characterise signals by measures such
as energy and power
For example, the instantaneous power of a resistor is:
1 2
p(t ) v(t )i(t ) v (t )
R
and the total energy expanded over the interval [t1, t2] is:
t2 t2 1
t1 t1 R (t )dt
2
p (t ) dt v
5/25
Generic Signal Energy and Power
Total energy of a continuous signal x(t) over [t1, t2] is:
t2
E x(t ) dt
2
t1
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: T
E lim T x(t ) dt x(t ) dt
2 2
T
1
x[n]
N
P lim N
2
2 N 1 n N
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)
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:
y(t ) x(at b)
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.
8/25
Periodic Signals
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 2p
x(t ) x(t T )
where T>0, for all t.
Examples:
cos(t+2p) = cos(t)
sin(t+2p) = sin(t)
Are both periodic with period 2p
9/25
Odd and Even Signals
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:
x(t ) x(t )
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
x(t ) x(t )
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.
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:
x(t ) Ce at
where C and a are, in general, complex numbers. Lets investigate
some special cases of this signal
Real exponential signals
Exponential growth Exponential decay
a0 a0
C 0 C 0
11/25
Periodic Complex Exponential &
Sinusoidal Signals
Consider when a is purely imaginary:
x(t ) Ce jw0t
By Eulers relationship, this can be expressed cos(1)
as:
e jw0t cos w0t j sin w0t
This is a periodic signals because:
e jw0 (t T ) cos w0 (t T ) j sin w0 (t T )
cos w0t j sin w0t e jw0t
when T=2p/w0
A closely related signal is the sinusoidal T0 = 2p/w0
signal: =p
x(t ) cosw0t w0 2pf 0 T0 is the fundamental
We can always use: time period
A cosw0t A e j (w0t ) w0 is the fundamental
A sin w t Ae
j (w0t )
frequency
0
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:
T0
E period e jw0t 2
dt
0
T0
1dt T0
0
Therefore:
E
Average power:
1
Pperiod E period 1
T0
Useful to consider harmonic signals
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:
C C e j
a r jw 0
So
Ce at C e j e( r jw0 )t C ert e j (w0 )t
Using Eulers relation
Ce at C e j e( r jw0 )t C ert cos((w0 )t ) j C ert sin((w0 )t )
These are damped sinusoids
14/25
Discrete Unit Impulse and Step Signals
The discrete unit impulse signal is defined:
0 n 0
x[n] [n]
1 n 0
Useful as a basis for analyzing other signals
15/25
Continuous Unit Impulse and Step Signals
The continuous unit impulse signal is
defined:
0 t 0
x(t ) (t )
t 0
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
0 t 0
x(t ) u (t )
1 t 0
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
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
18/25
Other Matlab Programming Structures
Loops Decisions
if i==5
for i=1:100
a = i*2;
sum = sum+i;
else
end
a = i*4;
Goes round the for loop 100
times, starting at i=1 and end
finishing at i=100 Executes whichever branch is
appropriate depending on test
i=1; switch i
while i<=100 case 5
sum = sum+i; a = i*2;
i = i+1; otherwise
end a = i*4;
Similar, but uses a while loop end
instead of a for loop
Similar, but uses a switch
19/25
Matlab Help!
These slides have provided a rapid introduction to Matlab
Mastering Matlab 6, Prentice Hall,
Introduction to Matlab (on-line)
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
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.
22/25
Signals in Simulink
Two main libraries for manipulating signals in
Simulink:
Sources: generate a signal
Sink: display, read or store a signal
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
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!
25/25
Lecture 2: Exercises
Text:
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!
26/25