Dear Prof Pfeifer，
Recently, I am studying your particle filter. In file evaluate_prior_AR1.m, there different prior distributions (beta, gamma, uniform) of parameters are considered.
Now, I have the following question:
(1) In the Uniform distribution, there is equation “priorval=priorval-log(7)”. Why we should include the term “log(7)”？ What does it mean ?
(2) If the prior distribution is Normal(-5.3,0.4) or truncated Normal disribution (0.5,0.3) . How should the evaluate_prior_AR1.m be modified?

The density of a uniform distribution on [a,b] is 1/(a-b). So log density is -\log(a-b). We assumed a uniform on [-7,0] if I remember correctly, giving you the mentioned value.

It should be something like

%parameter ~ N(mu,sigma) with truncation at truncation_lower_bound and truncation_upper_bound
ii=[5];
if par(ii)>=truncation_lower_bound && par(ii)<truncation_upper_bound
priorval=priorval+normpdf(par(ii),mu,sigma);
else
alarm=1;
return
end

where you need to fill in the respective parameter values.