Skip to content

Instantly share code, notes, and snippets.

import numpy as np
import matplotlib.pyplot as plt
N = 2048
N_CP = 3
h = [1, 0.4-0.3j, 0.2+0.4j, -0.3+0.4j]
# Generate N random QPSK symbols
x = np.sign(np.random.randn(N)) + 1j * np.sign(np.random.randn(N))
import numpy as np
import matplotlib.pyplot as plt
T = 1
delta_f = 1 / T
M = 8
N = 8
OVERSAMPLING = 128
t = np.arange(-10 * N * M * T, 10 * N * T * M, 1 / OVERSAMPLING)
import numpy as np
N = 8
h = np.array([1+1j, 0.5-0.4j, 0.2 + 0.3j])
x = np.array([1, 3, 2, 4, 7, -3, 4, 5])
assert(len(x) == N)
# Convolution
y = np.convolve(x, h)
print(y)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
import matplotlib.pyplot as plt
# Ts = 0.01
# N = 400
t = np.arange(0, 4, 0.01)
x = np.cos(2 * np.pi * t)
# plt.plot(t, x)
# plt.show()
import numpy as np
import matplotlib.pyplot as plt
import scipy.signal
SAMPLE_RATE = 44100
DURATION_SEC = 2
FREQ1 = 1000
FREQ2 = 1050
T = 1 / SAMPLE_RATE

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),
]