-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathproblemA_p_theta_rnd.m
35 lines (30 loc) · 991 Bytes
/
problemA_p_theta_rnd.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function p = problemA_p_theta_rnd(lb, ub, N)
% Sampling from the prior PDF for the example in problemA.m
%
% USAGE:
% p = problemA_p_theta_rnd(lb, ub, N)
%
% INPUTS:
% lb, ub = lower and upper bounds of the uniform PDF 1 x dim_theta
% N = number of samples to generate
%
% OUTPUTS:
% p = samples N x dim_theta
%
% EXAMPLE:
%{
p = problemA_p_theta_rnd([1 2 3 4 5], [2 3 4 5 6], 10)
%}
%--------------------------------------------------------------------------
% who when observations
%--------------------------------------------------------------------------
% Diego Andres Alvarez Jul-24-2013 First algorithm
%--------------------------------------------------------------------------
% Diego Andres Alvarez - [email protected]
% Here an uniform non informative prior is employed
dim_theta = length(lb);
p = zeros(N, dim_theta);
for i = 1:dim_theta
p(:,i) = unifrnd(lb(i), ub(i), N, 1);
end
return;