TTT4260/Øvinger/Ø5/BodeDiagram.py

45 lines
704 B
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 28 11:00:18 2019
@author: oyvind
"""
import numpy as np
import matplotlib.pyplot as plt
def H13(f):
w = 2 * np.pi * f
return (w * 10**(-4))/np.sqrt(1+(w*10**(-4))**2)
def H2(f):
w = 2 * np.pi * f
return (1/np.sqrt(1+(w*100*10**(-9)*10**4)**2))
def H4(f):
w = 2 * np.pi * f
R = 99.76
L = 100 * 10**(-3)
t = L / R
return (1/np.sqrt(1+(w*t)**2))
frq = []
values = []
for i in range(2*10**4):
frq.append(i)
value = 20 * np.log10(abs(H4(i)))
values.append(value)
plt.plot(frq, values)
plt.xscale('log')
plt.gca().xaxis.grid(True)
plt.gca().yaxis.grid(True)