Skip to content

Instantly share code, notes, and snippets.

@insom
Created December 31, 2016 06:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save insom/46af7810b0b4d344659e6f6984d80ffc to your computer and use it in GitHub Desktop.
Save insom/46af7810b0b4d344659e6f6984d80ffc to your computer and use it in GitHub Desktop.
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