import numpy as np
= np.arange(0, 0.5, 1/1000) # 500 ms of time at 1000 Hz
t = np.sin(2*np.pi*30 * t) # pure sinusoid at 30 Hz
y1 = np.sin(2*np.pi*125 * t) # pure sinusoid at 125 Hz
y2 = np.sin(2*np.pi*300 * t) # pure sinusoid at 300 Hz
y3 = y1 + (0.8*y2) + (0.9*y3) y
Homework 7
Due: Mar 16 by 11:59 pm eastern standard time
Submit a single file called name_07.py
to Brightspace/OWL where name
is replaced with your last name, e.g. gribble_07.py
Signal Processing Exercises
Here is some Python code to generate a complex signal composed of sinusoids at several frequencies. The signal is sampled at 1000 Hz.
- Plot the signal
y
in the time domain. Label the axes and include a title. - Plot the magnitude spectrum of
y
using thescipy.signal.welch()
function. Label the axes and include a title. - Highpass filter the signal to remove the 30 Hz component. Plot the filtered signal in the time domain and also plot the magnitude spectrum of the filtered signal. Label the axes and include a title.
- Lowpass the filtered signal from 3. to remove the 300 Hz component. Plot the filtered signal in the time domain and also plot the magnitude spectrum of the filtered signal. Label the axes and include a title.