Hi, Iwan
You've basically have to understand the Bayes Law:
p(x|z) = [p(z|x).p(x)]/p(z) (see
http://en.wikipedia.org/wiki/Bayes'_theorem )
You don't measure p(x|z) (posterior density), cause it's hard to obtain. So, you resort to the above expression, since terms in the left hand side of the expression are easier to measure/estimate. You do have to estimate the p(z|x) (conditional density) and there are several methods for doing so.
To fully grasp the theory involved, read the tutorial:
A Tutorial on Particle Filters for On-line Non-linear/Non-Gaussian Bayesian Tracking (2001) - PDF:
http://citeseer.ist.psu.edu/504843.htmlFind the entire source code in C here:
http://www.robots.ox.ac.uk/~misard/condensation.htmlRegards