Experiment No.1 I DSP TMS320C6713 DSK & O DT & Matlab: Lab Manual EEE324 Digital Signal Processing
Experiment No.1 I DSP TMS320C6713 DSK & O DT & Matlab: Lab Manual EEE324 Digital Signal Processing
where 𝑛0 ∈ ℤ. A signal 𝑥(𝑛) is called an energy signal if 𝐸𝑥 is finite and a power signal if 𝑃𝑥 is
finite and 𝑃𝑥 ≠ 0.
1.3.4.5 Deterministic and Stochastic Signals
A function is called deterministic if, every time it is realized, it has the same output. For example,
the unit step function 𝑢(𝑛) will always be the same. In contrast, a random signal has different
values every time it is realized.
1.3.5 Properties of Systems
1.3.5.1 Causal and Non-Causal Systems.
A system is deemed causal if, at any point in time, its output does not depend on future values of
inputs. For example,
>> y = @(x, n) x(n) + x(n - 1);
is a causal system, because at any given time 𝑛0 , the value of its output only depends on values
of 𝑛 such that 𝑛 ≤ 𝑛0 . However,
>> y = @(x, n) x(n) + x(n + 1);
is non-causal, because its output depends on future values of the input signal.
1.3.5.2 Static (Memory-less) and Dynamic (with Memory) Systems
A static system is one that has no memory. Its output at any time depends only on the current value
of the input. For example:
𝑆{𝑥(𝑛)} = 𝑥(𝑛)2
A dynamic system is a system where the output can depend not only on the current value of the
input but may also past and future values. For example,
1
𝑆{𝑥(𝑛)} = (𝑥(𝑛 − 1) + 2𝑥(𝑛) + 𝑥(𝑛 + 1))
2
1.3.5.3 Linear Systems
Additive System: An additive system is one for which the following property holds:
𝑆{𝑥1 (𝑛) + 𝑥2 (𝑛)} = 𝑆{𝑥1 (𝑛)} + 𝑆{𝑥2 (𝑛)} ∀𝑥1 , 𝑥2 , 𝑛
Homogenous System: A homogenous system is one for which the following property holds:
𝑆{𝑎𝑥(𝑛)} = 𝑎𝑆{𝑥(𝑛)} ∀𝑥, 𝑎, 𝑛
Linearity of a System: A system is called linear if it satisfies both the additivity property and the
homogeneity property. If either additivity or homogeneity fails, then system is nonlinear system.
1.3.5.4 Shift-Variant and Shift-Invariant Systems
A system is called a shift-invariant if a shift in the input results in the same amount of shift in the
output. Concretely, if 𝑆{𝑥(𝑛)} = 𝑦(𝑛), then a system is called shift invariant if and only if
𝑆{𝑥(𝑛 − 𝑛0 )} = 𝑦(𝑛 − 𝑛0 ) ∀𝑥, 𝑛0
0.5
-0.5
-1
-1.5
0 1000 2000 3000 4000 5000 6000 7000 8000
𝐻(𝑧) = ∑ ℎ(𝑛)𝑧 −𝑛
𝑛=−∞
Replacing the lower limit of the sum from minus infinity to zero yields the one-sided (or unilateral)
z-transform whose mathematical expression is:
∞
Where 𝑧 = 𝑟𝑒 𝑗𝜔 is complex, with the magnitude representing the decay and the phase representing
the oscillation. If the decay part does not exist, i.e. 𝑟 = 1, the Z-Transform simplifies to the
discrete-time Fourier transform DTFT. In order to return from the z-domain back to the discrete-
time domain, the inverse z-transform is applied. The inverse z-transform is denoted by the symbol
𝑍 −1 {. } that is, one can write:
1
ℎ[𝑛] = 𝑍 −1 {𝐻(z)} = ∮ 𝐻(𝑧)𝑧 𝑛−1 𝑑𝑧
2𝜋𝑗
Usually, this integration is complex, and inverse Z-Transform is found using tables of Z-transform
pairs.
When LTI system is described by the difference equation
𝑁 𝑀
The system function can be easily computed, by taking the z-transform of both sides and using the
properties of z-transform, we obtain
6.3 Pre-Lab
6.3.1 Fourier series for discrete time periodic signals
If a discrete-time signal is periodic with a fundamental period of 𝑁, then its Discrete-Time Fourier
Series (DTFS) is given by
𝑁−1
1
𝑋(𝑘) = 𝑐𝑘 = ℱ{𝑥(𝑛)} = ∑ 𝑥(𝑛)𝑒 −𝑗2𝜋𝑘𝑛⁄𝑁 ,
𝑁
𝑛=0
and it is also periodic with a fundamental period of 𝑁. To get 𝑥(𝑛) back from 𝑋(𝑘), we use the
formula
𝑁−1 𝑁−1
𝑗2𝜋𝑘𝑛⁄𝑁
𝑥(𝑛) = ℱ −1 {𝑋(𝑘)}
= ∑ 𝑋(𝑘)𝑒 = ∑ 𝑐𝑘 𝑒 𝑗2𝜋𝑘𝑛⁄𝑁
𝑘=0 𝑘=0
This formula is also known as the discrete-time Fourier series representation of a signal. The since
both the series and its inverse are periodic, it is always sufficient to look at them for one time
period only.
The average power of a discrete time periodic signal with period N is given by:
𝑁−1 𝑁−1
1
𝑃𝑥 = ∑|𝑥(𝑛)|2 = ∑|𝑐𝑘 |2
𝑁
𝑛=0 𝑘=0
∑ |𝑥(𝑛)| ∈ ℝ+
0
𝑛=−∞
which is known as the frequency domain representation of the signal 𝑥(𝑛). To represent this, we
ℱ
write 𝑥(𝑛) → 𝑋(𝜔). The DTFT of a signal is always 2𝜋-periodic. One can obtain the discrete time
signal from 𝑋(𝜔) by taking inverse Fourier transform as follows:
1 𝜋
𝑥(𝑛) = ∫ 𝑋(𝜔)𝑒 𝑗𝜔𝑛 𝑑𝜔
2𝜋 −𝜋
6.4 In-Lab
Determine the spectra of the following signal using Fourier series coefficients.
𝜋𝑛
a) 𝑥(𝑛) = 𝑐𝑜𝑠 ( 3 )
1
b) 𝑥(𝑛) is periodic with period 𝑁 = 4 and 𝑥(𝑛) = { , 1,0,0}
↑
%% Part a
syms n k
x = @(n) cos((pi*n)/3);
N = 6;
ck = @(k) simplify((1/N)*symsum(x(n).*exp(-(j*2*pi*k*n)/N),n,0,N-1));
ck(k)
kr = -10:10;
figure; stem(kr, ck(kr))
figure; stem(kr, (abs(ck(kr))).^2)
Px = symsum((abs(ck(k))).^2, k, 0, N-1)
%% Part b
syms n k
N = 4;
x = @(n) heaviside(mod(n,N)) - heaviside(mod(n,N)-2);
ck = @(k) simplify((1/N)*symsum(x(n).*exp(-(j*k*2*pi*n)/N),n,0,N-1));
ck(k)
Determine the Fourier series coefficients and power density spectrum of the following periodic
signal for L = 5, 𝑁 = 40 and 60
1 0≤ 𝑛 ≤ 𝐿−1
𝑥(𝑛) = {
0 𝐿 ≤𝑛 ≤𝑁−1
syms n k
sympref('HeavisideAtOrigin',1);
N1 = 40;L = 5;
x = @(n) heaviside(mod(n,N1)) - heaviside(mod(n,N1)-L);
ck = @(k) simplify((1/N1)*symsum(x(mod(n,N1)).*exp(-(j*k*2*pi*n)/N1),
n, 0, N1-1));
kr = -60:60;
figure; stem(kr,ck(kr))
figure; stem(kr,(abs(ck(kr))).^2)
N2 = 60;
x2 = @(n) heaviside(mod(n,N2)) - heaviside(mod(n,N2)-L);
ck1 = @(k)simplify((1/N2)*symsum(x2(mod(n,N2)).*exp(-(j*k*2*pi*n)/N2),
n, 0, N2-1));
figure; stem(kr,ck1(kr))
figure; stem(kr,(abs(ck1(kr))).^2)
Determine Fourier transform of following signal and plot its energy density spectrum.
syms n w
a = 0.5;
x = @(n) a.^n;
X = @(w) symsum(x(n) .* exp(-j * w * n), n, 0, inf);
X(w)
wr = -pi:0.1:pi;
figure; plot(wr,X(wr));
figure; plot(wr,(abs(X(wr))).^2)
Determine the Fourier transform and energy density spectrum of the following sequence for L =
5. Plot magnitude and phase spectrum of 𝑋(𝜔)
1 0≤ 𝑛 ≤ 𝐿−1
𝑥(𝑛) = {
0 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
syms n w
L = 5;
x = @(n) heaviside(n) - heaviside(n-L);
X = @(w) symsum(x(n) .* exp(-j * w * n), n, 0, inf);
X(w)
6.5 Post-Lab
1. Determine the signal 𝑥(𝑛) if its Fourier transform is given as follows:
a) x1 (n) = x(n)cos(𝜋n/4)
b) x2 (n) = x(n)sin(𝜋n/2)