Skip to content

Instantly share code, notes, and snippets.

Teaching tips

Kumar Appaiah, Associate Professor, Department of Electrical Engineering, IIT Bombay

I would like to preface this with the information that I chose to become a teacher primarily because I was very positively influenced by my teachers, especially at the undergraduate level. The happiness of seeing my students graduate and do great things in industry is a reward that has no parallels, and I am very grateful for this

import numpy as np
import matplotlib.pyplot as plt
N = 100
bpsk_data = np.sign(np.random.randn(N))
h = np.array([1, 0.25, -0.25])
y = np.convolve(h, bpsk_data)
import numpy as np
import matplotlib.pyplot as plt
import scipy
np.set_printoptions(edgeitems=30, linewidth=100000, formatter=dict(float=lambda x: "%.3g" % x))
# We will create an ideal truncated filter
Ts = 44100
# 0.5 seconds
import numpy as np
M = 8
N = 8
triplets = [
(1 - 0.3j, 0, 0),
(0.3 + 0.4j, 1, 1),
(0.7 - 0.6j, 2, 1),
]
import numpy as np
from scipy.linalg import null_space
A_2 = 0.1
t = 0.3
fd1 = 100
fd2 = 120
two_pi_fd1_t = 2 * np.pi * fd1 * t
two_pi_fd2_t = 2 * np.pi * fd2 * t
theta_1 = np.random.rand() * 2 * np.pi
import numpy as np
import matplotlib.pyplot as plt
T = 1
Ts = 1e-3
t = np.arange(-3, 10, Ts)
symbols = [1, 1, 1, 1]
N_SYMBOLS = len(symbols)
import numpy as np
M = 4
p = 2
beta = 1
c = p * M + beta
C = np.array([-3 / 4, -1 / 4, 1 / 4, 3 / 4]) * c
import numpy as np
import matplotlib.pyplot as plt
M = 8
N = 8
T = 1
Delta_F = 1
triplets = [(1, 0, 0), (0.5, 1 * T / M, 0.4 * Delta_F / N)]
import numpy as np
import matplotlib.pyplot as plt
import sys
Ts = 0.000001
n_cycles = 240000
if len(sys.argv) > 1:
n_cycles = int(sys.argv[1])
t = np.arange(0, n_cycles * Ts, Ts)
import numpy as np
import matplotlib.pyplot as plt
# Minimize f(x) = 2 + (x - 3)^2
def f(x):
return 2 + (x - 3)**2
def fdash(x):
return 2 * (x - 3)