[Program]Positioning

9 views
Skip to first unread message

cpyi

unread,
Jun 22, 2013, 1:46:52 PM6/22/13
to code_fellow...@googlegroups.com
Learning a whole semester of probability and statistics, I am not so sure I understand the whole content. 
But I think there are some interesting concept and problems in this scope, which are not so complicated actually.
I pick a problem and using C++ to solve the problem. In statistics, it is a two dimensional Bayesian statistics problem. 
Whatever it is called, I think it is a good programming problem.
Problem:
Suppose there is a square area, and there are some scanner randomly(known) distributed on this area.
A scanner has higher probability to detect object nearby, which is modeled as geometric distribution in this problem.
Given the position of the scanners, and whether the scanner detected the target.
We want to find the position of the target(using MAP rule).
Solution:
We assume the prior distribution of the target is uniform over the whole square area.
Together with the geometric distribution model given.
Using Bayesian rule, we can find the posterior distribution.
Iterate over whole square and using MAP rule to find the target position with highest probability.
Sample Code:
Given in the attachment file,which is self-explanatory if you know C++.
Improvement:
In this sample code, I use plain text to represent the output.
(0 for empty, 1 for undetected scanner, 2 for detected scanner, 3 for target position result, 4 for target position result which is the same as an detected scanner) 
Latter, I will improve the plotter program I wrote, and plot it out.
positioning.cpp
Reply all
Reply to author
Forward
0 new messages