aboutsummaryrefslogtreecommitdiff
path: root/sem5/sig/mm6/opg2.py
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-09-23 17:53:34 +0200
committerJulian T <julian@jtle.dk>2020-09-23 17:53:34 +0200
commitfef26c3cd47c1e6d3a9dc7592db5721b996ead6b (patch)
tree688162f271a9968b78bd53a3b52732121de85cb7 /sem5/sig/mm6/opg2.py
parent5de991dd326103647b28e7d95b92b32a9e1671b9 (diff)
Added signal processing assignment
Diffstat (limited to 'sem5/sig/mm6/opg2.py')
-rw-r--r--sem5/sig/mm6/opg2.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/sem5/sig/mm6/opg2.py b/sem5/sig/mm6/opg2.py
new file mode 100644
index 0000000..38d65fe
--- /dev/null
+++ b/sem5/sig/mm6/opg2.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python3
+# 2020-09-23:s5/sig/mm6/opg/2
+
+import matplotlib.pyplot as plt
+import sys
+import numpy as np
+
+lookahead = 100
+values = 50
+
+res = np.empty(values)
+
+for n in range(values):
+ s = 0
+ for k in range(lookahead):
+ h = np.exp(-k/8)
+
+ x = 1
+ if (n - k) < 0:
+ x = 0
+
+ s += x * h
+ res[n] = s
+
+x = np.arange(values)
+
+plt.plot(x, res)
+plt.show()
+
+