EE 331 - Signals and Systems: - A Must For All EE Engineers/researchers
EE 331 - Signals and Systems: - A Must For All EE Engineers/researchers
EE 331 - Signals and Systems: - A Must For All EE Engineers/researchers
• Text-book:
– Oppenheim & Willsky, Signals and Systems, 2nd
edition, Prentice Hall.
• It is assumed that you have a background of:
– advanced calculus (complex variables, linear system
theory)
– Laplace and Fourier transforms from Circuit II
PLAN:
Approximately 1 chapter per week
Labs on Mondays
Assistant: Fatih Üstok
2 Midterms, 1 Final, 1 Lab exam
1
Auditory signal processing Radar signal processing
2
Why MATLAB?
• Very easy to use
• Lots of built-in functions
• Many users – shared tools, available books
• It is used in: research and development both
in academy and industry
• Hepls you to create figures, movies for your
reports, presentations, etc.
Introduction to MATLAB
3
Matlab Resources
Introduction to Matlab:
http://www.maths.dundee.ac.uk/~ftp/na-reports/MatlabNotes.pdf
A Practical Introduction to Matlab
http://www.math.mtu.edu/~msgocken/intro/intro.html
Matlab Primer:
http://math.ucsd.edu/~driver/21d-s99/matlab-primer.html
Matlab Course:
http://www.chem.duke.edu/~boris/matlab/
http://www.math.utah.edu/lab/ms/matlab/matlab.html
...
Introduction to MATLAB
4
Introduction to MATLAB
Introduction to MATLAB
Defining an array:
>> x=[3.5+4*i -2.1-7.4*i]; row vector
>> x=[3.5+4*i ; -2.1-7.4*i]; column vector
>>x= -5 : 10 : 50; defines an array with boundaries and step
Defining a matrix:
>> A=[1 3 5 7 >> A=[1 3 5 7;2 4 6 8;9 11 13 15]
2468 OR
9 11 13 15]
A= A=
1 3 5 7 1 3 5 7
2 4 6 8 2 4 6 8
9 11 13 15 9 11 13 15
5
Introduction to MATLAB
Size of an array or matrix:
>> x=[1 2 3]; size(x) Without ; => prints on the screen
ans =
1 3
For getting help for a command:
>> y=[1 2;2 3; 4 5];size(y)
>>help size
ans =
3 2
Length of a vector ...
>> length(y)
=max(size(y)) for matrices
ans =
Introduction to MATLAB
Multiplication of vectors and matrices:
>> x=[1 2];y=[3 5]; z=[0 0;1 1];x*y' Vector multiplication
ans =
13
>> x.*y
The dot means ‘element-by-element’
ans =
3 10
>> z*y' Matrix multiplication
ans =
0
8
6
Introduction to MATLAB
Relational operators:
1 0 1
0 1 1
For and/or type operations,
1 0 1 x≠0 corresponds to 1
1 1 1 x=0 corresponds to 0
Introduction to MATLAB
Control flow commands:
if for while end else elseif break return switch ...
7
Introduction to MATLAB
Special characters and variables:
pi inf i % : ... Type ‘help :’ to get a complete list
Introduction to MATLAB
>> whos Lists all current variables
Name Size Bytes Class
All variables are set to
ans 3x1 24 double array
double by default and
x 3x2 48 double array
operations are handled
y 1x5 40 double array
with double precision
>> clear all clears all current variables
>> clear x clears only x
>>global x sets x as global
8
Introduction to MATLAB
Plotting:
•Initalize a figure
>> figure;plot(1:2:100);axis('tight');
•Plot a signal
>> xlabel('a signal');ylabel('y axis');legend y=2x
•Stretch to ends
•Put a label to x
•Put a label to y
•Switch legend
Figure copy:
Edit/Copy figure
Test yourself:
Edit/Copy options
Introduction to MATLAB
t=0:0.001:1;
x=10*sin(2*pi*10*t).*exp(-4*t);
plot(t,x);grid;
xlabel('Time');
ylabel('Amplitude')
title('x(t)=10sin(2*pi*10*t)exp(-4*t)');
9
Introduction to MATLAB
Examples: Plotting a sum of two sinusoids
t = -15:0.01:15;
y = cos(pi*t/2) + cos(pi*t/3);
plot(t,y); grid;
xlabel('t (seconds)'); ylabel('y(t)');
title('Plot of y(t)');
print '-djpeg' ‘ex1‘;
Prints to file ex1.jpg
Drill for next lab session:
Write a matlab function (.m file) that accepts frequency of
oscillation, number of samples in a second and the initial phase
(in radians) as input and creates the signal below and plots it.
jωt +φ
x(t ) = e
10
REALITY MODEL
“Signal”
Information in the Mathematical
form of functions
-audio Abstract
- video
- text
11
x[n] is undefined for n
non-integer
12
Sürekli-zaman
Ayrık-zaman
13
Energy of a signal: Application: Gate processing
t1
n2
Not: Buradaki mutlak değer aslında “norm”
E = ∑ x[n] operatörüdür. Sinyalin içeriği kompleks ise
2
vektör boyuna karşılık gelir.
n1
14
Basic signals - CT
Unit step Unit impulse
15
Basic sequences - DT
also named an “impulse”
16
Basic sequences - Matlab
>>x1=zeros(1,20);x1(1)=1;stem(x1)
>> disp(x1)
Columns 1 through 10
1 0 0 0 0 0 0 0 0 0 Unit impulse
Birim dürtü
Columns 11 through 20
0 0 0 0 0 0 0 0 0 0
>> x2=ones(1,20);stem(x2)
Unit step
Birim basamak
17
Basic sequences – Exponential – Continuous Time
x(t)=Ceat
Üstel sinyal
e jϕ + e − jϕ
cos ϕ =
2
e jϕ − e − jϕ
sin ϕ =
2j
Phasors:
e j (ω0t +ϕ ) + e − j (ω0t +ϕ )
A cos(ω0t + ϕ ) =
2
18
Complex Exponential Function: frequency
Ce at = C e jθ e ( r + jω0 )t = C e rt e j (ω0t +θ )
Exponential Oscillator
a = r + jω 0
{ }
envelope
x(t ) = ℜ Ce at
frequency
>> A=5;alfa=0.6+i*0.5;
for k=1:200; x(k)=A*(alfa^k);end
plot(x,'.');grid;
Karmaşık üstel sinyal/dizi
19
Basic sequences - Exponential
for w=0:pi/200:pi/2
alfa=r*exp(i*w);
frequency of oscillation in
for k=1:K
radians
x(k)=A*(alfa^k);
end
end
20
Periodic continuous-time signals
Periodic sequences:
>>n=0:100;
>>x=cos(pi/20*n+0);
>>stem(x);hold;plot(x);hold
21
Period of an oscillatory signal
π π
cos( n + 0) = cos( (n + N ) + 0)
20 20
π π π
n + 2πk = n+ N
20 20 20
π
2πk = N
20
N = 40
22
Does this property hold
for continuous time
signals?
23
Basic sequences – Continuous Time
Euler’s relation:
24
Transformations of the independent variable
Let’s do it in Matlab
>>cd D:\dersNotlari\EE331_SignalsAndSystems\lecture1wav
>>[s,SamplingFreq]=wavread(‘ses.wav’);
>>soundsc(s, SamplingFreq);
>>s2=s(length(s):-1:1);
>>soundsc(s2, SamplingFreq);
25
Transformations of the independent variable
Time scaling Time shift
Sampling demo
>> cd
D:\baris\dersler\dersNotlari\EE331_SignalsAndSy
stems\DEMOS\con2dis-v200\con2dis
>> con2dis
26
Bunlar neden önemli?
Çünkü sinyallerde
temel işlemler bunlar,
ders boyunca
karşılaşacağız.
27
f (t ) = f (−t )
f (t ) = − f (−t )
1 1
f (t ) = ( f (t ) + f (−t )) + ( f (t ) − f ( −t ))
2 2
Even part Odd part
28
Obtaining the odd part
Reading assignment:
Chap. 1 – Introduction
Chap. 2 – Signals and Systems
29