Created
February 25, 2015 08:42
-
-
Save albanie/4ebfa62880fd2492f2c1 to your computer and use it in GitHub Desktop.
Show that the result of summing two periodic signals is periodic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%matplotlib inline | |
import matplotlib.pyplot as plt | |
import numpy as np, math | |
"""Define the periodic function""" | |
def f(t): | |
return math.cos(2 * math.pi * t) + 0.5 * math.cos( 4 * math.pi * t) | |
"""Define inputs, find outputs and plot graph""" | |
inputs = np.linspace(-2, 2, 100) | |
outputs = [f(input) for input in inputs] | |
plt.plot(inputs, outputs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment