Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

1: for python position


import sys
import numpy as np
import matplotlib.pyplot as plt

y = np.loadtxt('acs712_192us.m')
size = len(y)

x = np.arange(0, size)

out = []

lamb = 0.9 

for i in range(len(y)):
    if i == 0:
       out.append(value) # value is what you want out[0] to be
    else:
        out.append(((1-lamb) * y[i]) + (lamb * out[i - 1]))

plt.plot(x, y)
plt.plot(x, out)
plt.show()

Source by w3programmers.org #
 
PREVIOUS NEXT
Tagged: #python #position
ADD COMMENT
Topic
Name
4+5 =