End sem 7; week 2 winter session 2025

This commit is contained in:
Aidan Sharpe
2025-01-15 17:59:04 -05:00
parent a00dde9ad4
commit a8d165aa1a
123 changed files with 19367 additions and 70 deletions

View File

@@ -0,0 +1,37 @@
import scipy as sp
import numpy as np
def chunk_samples(samples, num_rows):
return samples.reshape((samples.shape[0]//num_rows, num_rows))
def db(x):
return 10*np.log10(x)
def quad_demod(samples):
return 0.5*np.angle(samples[:-1] * np.conj(samples[1:]))
def lowpass(data, f_cutoff, f_s):
nyq = 0.5*f_s
normal_cutoff = f_cutoff/nyq
b, a = sp.signal.butter(2, normal_cutoff, btype="low", analog=False)
y = sp.signal.lfilter(b, a, data)
return y
def sdr_bandpass(data, f_pass, f_cutoff, extent_MHz):
lower_extent = extent_MHz[0]*1E6
upper_extent = extent_MHz[1]*1E6
extent_range = upper_extent - lower_extent
normal_pass = (f_pass - lower_extent)/extent_range
normal_cutoff = (f_cutoff - lower_extent)/extent_range
b, a = sp.signal.butter(2, (normal_pass, normal_cutoff), btype="bandpass", analog=False)
y = sp.signal.lfilter(b, a, data)
return y