Question01
1. Determine whether or not each of the following signals is periodic. If the signal is periodic,
calculate its fundamental period.
a) $x[n] = 3cos(5n+n/6) $
b) $x[n] = 2e^{j(\frac{n}{6} -n)} $
Answers:
a) $x[n] = 3cos(5n+n/6)$
x[n] is periodic $\iff$ there are exist integer N such that x[n] = x[n+Nk], where k is an any integer.
$$3cos[5n+n/6] = 3cos[31/6(n+N)]$$
$$cos[\frac{31n}{6}] = cos[\frac{31n}{6}] +cos[\frac{31N}{6}]$$
for periodic,
$$31N/6 = 2\pi k $$
$$N = 12\pi k/31$$
$\therefore \text {Can't fond any integer value for N as satisfy periodic condictions. So x[n] not periodic} $
b) $x[n] = 2e^{j(n/6-n)}$
x[n] is periodic $\iff$ there are exist integer N such that x[n] = x[n+Nk], where k is an any integer.
$$x[n] = 2e^{j(n/6-n)}$$
$$x[n] = 2e^{j(5n/6)}$$
for periodic,
$$2e^{j(5n/6)} = 2e^{j(5(n+N)/6)} $$
$$2e^{j(5n/6)} = 2e^{j(5n/6)} e^{j(5N/6)}$$
$$e^{j(5N/6)} = 1 $$
$$N = (2\pi )^k \times 6/5 $$
Since N is not integer, x[n] is not a periodic signal.
2. Simulate the above signals using a simulation tool for n=1,2,3,…,10. You can use any simulation tool to obtain the waveform of the signals (e.g. Matlab, SciLab, Octave).
#Setting up libries and plot settings
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
plt.rcParams["figure.figsize"] = (14,4)
n = np.linspace(1,10,11);
x_n_1 = 3*np.cos(5*n + n/6)
plt.stem(n,x_n_1);
plt.title("3 cos(5n+5/6)"); plt.xlabel("n"); plt.xticks(n); plt.ylabel("Amplitude"); plt.grid(True) #Setup graph
x_n_2 = 2*np.exp(((n/6)-n)*1j) # Question 1) b
plt.stem(n,x_n_2.real,label='Real Part') #plot real part
plt.stem(n,x_n_2.imag,label="Imeganary Part",linefmt = 'C6--') #plot real part
plt.title("2exp(j(n/6-n))"); plt.xlabel("n"); plt.xticks(n); plt.ylabel("Amplitude"); plt.grid(True) #Setup graph
plt.legend();
Question 02
1. Compute the convolution y(n) = x(n) h(n) of the following pairs of signals.*
x(n) = a"u(n)
h(n) = $b^n$ u(n) when a # b and when a = b =2
Answers:
When $a \neq b$
$$x[n] = a^n u[n]$$
$$h[n] = b^nu[n]$$
Then ,
$$x[n] * h[n] = \sum_{k=-\infty}^{\infty} x[k]u[k]h[n-k]n[n-k]$$
$$x[n] * h[n] = \sum_{k=0}^{n} a^kb^{n-k}$$
$$x[n] * h[n] = b^n \frac{1-(\frac{a}{b})^{n+1}}{1-(\frac{a}{b})}$$
$$x[n] * h[n] = \frac{b^{n+1}-a^{n+1}}{b-a}~$$
When $a=b=2$ $$x[n] * h[n] = \sum_{k=-\infty}^{\infty} x[k]u[k]h[n-k]n[n-k]$$ $$x[n] * h[n] = \sum_{k=0}^{n} a^ka^{n-k}$$ $$x[n] * h[n] = \sum_{k=0}^{n} a^n$$ $$x[n] * h[n] = (n+1) a^n$$ $${x[n] * h[n] = (n+1) 2^n}$$
2. Simulate the above signals using a simulation tool for n=1,2,3,…,10. You can use any simulation tool to obtain the waveform of the signals (e.g. Matlab, SciLab, Octave).
#Here can't use convolve function. Because convolve function assume that the signal exist only within defined range.
#But above calculations are made for the infinite sequences.
#
def compute_conv(a,b,n):
if(a==b):
return 0.1*(n+1)*a**n # if a=b for scalling multiply by 0.1
else:
return (b**(n+1)-a**(n+1))/(b-a)
plt.rcParams["figure.figsize"] = (14,10)
a = 2;
b = 2; #Initialize b and a
n = np.arange(0,16) # n=1,2,...15
m = np.arange(0,2*len(n)-1)
con = compute_conv(a,b,m)
x_n = a**n; #a^n u[n]
h_n = b**n; #b^n u[n]
plt.subplot(3,1,1); plt.stem(x_n); [plt.title("x_n")] # x_n
plt.subplot(3,1,2); plt.stem(h_n); [plt.title("h_n")] # h_n
plt.subplot(3,1,3); plt.stem(con); [plt.title("a = b =2 conv")]; plt.ylabel("x 11e10") # For a not equl b
Text(0, 0.5, 'x 11e10')
plt.rcParams["figure.figsize"] = (14,10)
a = 0.2;
b = 0.7; #Initialize b and a
n = np.arange(0,16) # n=1,2,...15
m = np.arange(0,2*len(n)-1)
con = compute_conv(a,b,m)
x_n = a**n; #a^n u[n]
h_n = b**n; #b^n u[n]
plt.subplot(3,1,1); plt.stem(x_n); [plt.title("x_n")] # x_n
plt.subplot(3,1,2); plt.stem(h_n); [plt.title("h_n")] # h_n
plt.subplot(3,1,3); plt.stem(con); [plt.title("a /= b conv")] # For a not equl b
[Text(0.5, 1.0, 'a /= b conv')]
Question 03
Determine the system function, impulse response, and zero-state step response of the system shown in
Figure 1.

System Function: $y[n] = x[n-1-t]+a\times y[n-1-t]$
Impulse Response: $h[n] = \delta[n-1-t] + ay[n-1-t]$
$\text{for n = 0, }y[0] = 0$
.
.
.
$\text{for n = t+1, }y[t+1] = 1$
.
.
.
$\text{for n = 2(t+1), }y[2t+2] = 1$
.
.
.
so, Impulse response is $ h[n] = \begin{cases}
1 & n = k(t+1), k=1,2,... \\
0 & Otherwise
\end{cases}
\ $
Zero-State Step Response: $x[n-1-t] + ay[n-1-t]$
$y[n] = u[n-1-t]+ay[n-1-t]$