Implement the sum-product algorithm for factor graphs in MATLAB for the Gaussian Bayesian network illustrated in Fig. 5 with the probabilities given in Eq. 1 - 3.

Modify the files `mainTemplate.m`, `kalmanFilter.m` and `kalmanSmoother.m` available for download on the course homepage^{2} and implement a) the Kalman filter algorithm and b) the Kalman smoother algorithm.
The task is to infer the trajectory of a robot that starts at position
and moves according to the linear transition model

(5) |

for given actions from the observations (green dots)

(6) |

as illustrated in Fig. 6. The environment and the parameters for the linear state transition and observation model are already provided in the file

Investigate and discuss the results for both algorithms. Hand in figures of representative results that show the actual robot trajectories and the most likely robot trajectories for both algorithms as infered by the sum-product algorithm.

Present your results clearly, structured and legible. Document them in such a way that anybody can reproduce them effortless. Hand in printouts of your MATLAB code.