DSP Lab02

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Digital Signal Processing HK232 [email protected].

vn

Lab #2
Objectives
- Review lecture notes of discrete-time signal and system
- Do additional exercises on SciLab
Report
1. For each function or group of functions that you did, you have to capture the screen as
evidence that you did by yourself.
2. Then, you add all screen captures in a single word file.
3. Finally, you upload your report to BKeL on time. You should down-size the image file to
reduce the report file in order to be able to submit it in BKeL.

---------------------------------
PART 1. REVIEW OF LECTURE NOTES

1.1. Elementary Signals

▪ Unit sample sequence (impulse)

δ ( n )={1, n=00 , n ≠0

▪ Unit step signal

u ( n ) ={1 , n≥ 00 , n< 0

▪ Unit ramp signal

ur ( n )={n ,n ≥ 00 , n<0

1.2. Signal Properties

▪ Periodic signal

A signal x(n) is periodic with a period N (N>0) if and only if x(n + N) = x(n), ∀n

▪ Signal’s energy

E x = ∑ |x ( n )|
2

n=−∞

1
Digital Signal Processing HK232 [email protected]

▪ Signal‘s average power


N
1

2
P x= |x ( n )|
2 N +1 n=−N
▪ Signal Symmetry

Any arbitrary signal can be expressed by the sum of two signal components
x ( n )=x e ( n )+ x o ( n )
Even signal component
1
x e ( n )=
2
[ x ( n )+ x (−n ) ]
Odd signal component
1
x o ( n )=
2
[ x ( n )−x (−n ) ]
1.3. Simple manipulations

▪ Delay

y ( n )=x ( n−k ) k >0


▪ Advance

y ( n )=x ( n+ k ) k >0
▪ Folding

y ( n )=x (−n )
▪ Addition

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

▪ Multiplication

y ( n )=x 1 ( n ) . x 2 ( n )
▪ Amplitude scaling

y ( n )=ax ( n )
---------------------------------

2
Digital Signal Processing HK232 [email protected]

PART 2. EXAMPLES & EXERCISES

Exercise 1.

Functions Description (will be filled by students)

plot2d3(…)

min(…)

max(…)

subplot(…)

title(…)

xlabel(…) Thiết lập nhãn trục x hoặc/và các thuộc tính của nó

ylabel(…) Thiết lập nhãn trục y hoặc/và các thuộc tính của nó

bool2s(…) Chuyển đổi ma trận boolean sang ma trận 0 1. Nếu x là


ma trận “chuẩn”, bool2s(x) trả về giá trị khác 0 thay thế
cho 1.

deff(…) Được dùng để định danh một hàm

Exercise 2. Try the following scripts on Scilab and report what your understanding after
observing the output.
scilab:> n = -5:5;
scilab:> msignal = bool2s (n >= 0);
scilab:> plot2d3(n, msignal)
Trả lời: Xuất hiện 1 đồ thị có trục hoành bao gồm các giá trị của n, trục tung gồm các giá trị
của msignal.

Exercise 3. Try the following scripts on Scilab and report what your understanding after
observing the output.

3
Digital Signal Processing HK232 [email protected]

scilab:> n = -5:5;
scilab:> msignal = bool2s (n == 0);
scilab:> plot2d3(n, msignal)
Trả lời: Xuất hiện 1 đồ thị có trục hoành bao gồm các giá trị của n, trục tung gồm các giá trị
của msignal.

Exercise 4. Use Scilab to draw the unit ramp signal ur(n) for n=-5:5
--> n = -5:5
--> msignal = n.*bool2s(n>=0)
--> plot2d3(n,msignal)

Exercise 5. Given a discrete-time signal x(n)={1, 3↑, -2}.


Use Scilab to draw the signal x(n), the odd signal component x o(n), and the even signal
component xe(n). Each signal will be drawed by a single plot but they are displayed in a
single window. Please use title(), xlabel() and ylabel() to represent the name of each plot.
Trả lời:
Signal x(n):

4
Digital Signal Processing HK232 [email protected]

Odd signal component xo(n):

Even signal component xe(n):

5
Digital Signal Processing HK232 [email protected]

Exercise 6. Given two discrete-time signals


x1(n)={0↑, 1, 3, -2} and x2(n)={0, 1↑, 2, 3}.
Determine y(n) = x1(n) + x2(n). Then use Scilab to draw x1(n), x2(n) and y(n). Each signal
will be drawed by a single plot but they are displayed in a single window. Please use title(),
xlabel() and ylabel() to represent the name of each plot.
Trả lời:
x1(n) signal:

x(2)n signal:

6
Digital Signal Processing HK232 [email protected]

y(n) signal:

Exercise 7. Given two discrete-time signals


x1(n)={0↑, 1, 3, -2} and x2(n)={0, 1↑, 2, 3}.
Determine y(n) = x1(n).x2(n). Then use Scilab to draw x1(n), x2(n) and y(n). Each signal
will be drawed by a single plot but they are displayed in a single window. Please use title(),
xlabel() and ylabel() to represent the name of each plot.
x1(n), x2(n) như bài 6:
y(n) signal:

7
Digital Signal Processing HK232 [email protected]

Exercise 8. Given a discrete-time signal x(n)={1, -2, 3↑, 6}.


Determine the following signal and then use Scilab to draw the original signal x(n) and the
manipulated signal yi(n). Each pair of plots will be display in a single window. Please use
title(), xlabel() and ylabel() to represent the name of each plot.
a. y 1 ( n )=x (−n )
b. y 2 ( n )=x ( n+3 )
c. y 3 ( n )=2 x (−n−2 )
Trả lời:
a.

b.

You might also like