%matplotlib inline
import matplotlib
matplotlib.use('Agg')
#Current Transformer
import math
i_rms_current = 60
nb_turns = 2000
U_sensor = 1
I_measured = math.sqrt(2) * i_rms_current
I_sensor = I_measured / nb_turns
print(I_sensor)
R_burden = U_sensor / I_sensor
print(R_burden)
P = I_sensor * I_sensor * R_burden
print(P)
0.042426406871192854 23.57022603955158 0.042426406871192854
avg = 2/math.pi
print(avg)
rms = 1/math.sqrt(2)
print(rms)
print(avg/rms)
print(avg/rms*220)
print(220/rms)
0.6366197723675814 0.7071067811865475 0.9003163161571062 198.06958955456335 311.1269837220809
from numpy import *
import matplotlib.pyplot as plt
x = arange(0.,2 * pi,0.001)
y = sin(x)
y2 = abs(sin(x))
plt.plot(x,y)
plt.plot(x,y2)
plt.show()
sqrt(mean(square(y))) == sqrt(mean(square(y2))) # True
sqrt(mean(square(y2)))
0.70706094306489775
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(range(3))
#fig.savefig('temp.png')
fig.show()
/home/ec2-user/anaconda3/lib/python3.4/site-packages/matplotlib/figure.py:387: UserWarning: matplotlib is currently using a non-GUI backend, so cannot show the figure "matplotlib is currently using a non-GUI backend, "
import numpy as np
def f(z,t):
return np.exp(-z)*np.sin(t-z)
z = np.linspace(0,5,100)
t = np.arange(0,40000,4000)
for tval in t:
plt.plot(z, f(z, tval))
plt.show()
t
len(z)
100