aboutsummaryrefslogtreecommitdiff
path: root/sem5/sig/mm6/opg3.py
blob: c338c49f56ebcf2f9208e7a0ed54611582bcff3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python3
# 2020-09-23:s5/sig/mm6/opg/3 #cc7f

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

# Load data
data = []
with open(sys.argv[1], "r") as f:
    for line in f:
        data.append(float(line))

data = np.array(data)
datalen = len(data)

x = np.arange(datalen)
before = plt.subplot(2, 1, 1)
after  = plt.subplot(2, 1, 2)
before.plot(x, data)

res = np.empty(datalen)

for i in range(datalen):
    last = res[i-1] if i > 0 else 0
    res[i] = np.exp(-1/8) * last + 1/8 * data[i]

after.plot(x, res)
plt.show()