# Experiment No: 01
# Written by: Al Mamun Siddiki
import numpy as np
import matplotlib.pyplot as plt
n = range(-3, 4, 1)
y = []
for i in range(len(n)):
temp = (1 if n[i] == 0 else 0)
y.append(temp)
plt.subplot(221)
plt.stem(n, y)
plt.title('Unit Impulse')
plt.axis([-3.1, 3.1, -0.1, 1.1])
n = range(-2, 6, 1)
y = []
for i in range(len(n)):
temp = (1 if n[i]>=0 else 0)
y.append(temp)
plt.subplot(222)
plt.stem(n, y)
plt.title('Unit Step')
plt.axis([-2.1, 5.1, -0.1, 1.2])
plt.grid(True)
n = range(-2, 6, 1)
y = []
for i in range(len(n)):
temp = (n[i] if n[i]>=0 else 0)
y.append(temp)
plt.subplot(223)
plt.stem(n, y)
plt.axis([-2.1, 5.1, -0.1, 5.2])
plt.title('Ramp Signal')
plt.grid(True)
a = 0.9
n = range(0, 26, 1)
y = []
for i in range(len(n)):
temp = a**n[i]
y.append(temp)
plt.subplot(224)
plt.stem(y)
plt.axis([-0.3, 25.1, -0.1, 1.1])
plt.title('Exponential signal')
plt.grid(True)
plt.show()