Created
May 14, 2019 20:06
-
-
Save d-demirci/375da08c82e2ea1abf34f1da2641c8c4 to your computer and use it in GitHub Desktop.
fourrier series sine waves to make square wave
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
from sys import platform as sys_pf | |
if sys_pf == 'darwin': | |
import matplotlib | |
matplotlib.use("TkAgg") | |
from matplotlib import pyplot as plt | |
import numpy as np | |
x = np.arange(-np.pi,np.pi,0.01) | |
sin_cumulative = 0 | |
for i in range(1,400,2): | |
sin_cumulative += np.sin(i*x) / (i) | |
plt.plot(x,sin_cumulative) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment