Create a gist now

Instantly share code, notes, and snippets.

@insom /bode.py
Created Dec 31, 2016

Bode Plot-ish
import math
import matplotlib.pyplot as plt
x = ((10,1.03),(50,1.03),(100,1.01),(500,1.005),(1000,1.015),(2500,1.00),(5000,0.98),(10000,0.92),(15000,0.84),(20000,0.75),)
hzz=[]
dbs=[]
for hz, v in x:
hzz.append(hz)
db = 20*math.log10(v/0.1)
dbs.append(db)
plt.plot(hzz,dbs)
plt.ylabel('dB')
plt.xlabel('Frequency')
plt.xscale('log')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment