Skip to content

Commit 60142bb

Browse files
committed
bayes filter main plot ready
1 parent 38add1f commit 60142bb

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

MyCode/Bayes Filter/test.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,31 @@
44
import numpy as np
55

66

7+
def task_2():
8+
"""start
9+
"""
10+
11+
fig, axs = plt.subplots(1, 1, figsize=(8, 4))
12+
13+
simulation_scope = 10
14+
15+
# Initial p(x)
16+
p = [0.5, 0.5]
17+
y = np.array(p)
18+
19+
y = np.concatenate((y, np.zeros(simulation_scope-len(p),)))
20+
21+
x = np.arange(simulation_scope)
22+
23+
ax = axs
24+
ax.set_title(r'Initial $p(x)$')
25+
bar_plot(ax, x, y, color='k')
26+
27+
ax.set_xlim(-1, simulation_scope+1)
28+
29+
plt.show()
30+
31+
732
def task_1():
833
"""PDF as bar plot
934
"""
@@ -44,3 +69,5 @@ def task_1():
4469
# PDF as bar plot
4570
if task == 1:
4671
task_1()
72+
elif task == 2:
73+
task_2()

0 commit comments

Comments
 (0)