-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdet_rv_bounds.m
73 lines (54 loc) · 2.14 KB
/
det_rv_bounds.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
% Determine lower and upper bounds of random variables
%
%SYNOPSYS
% probdata = DET_RV_BOUNDS(probdata)
%
%
function probdata = det_rv_bounds(probdata, umax)
if nargin < 2
umax = [];
end
marg = probdata.marg;
n_rv = size(marg,1);
bounds = nan(n_rv, 2);
for ii = 1:n_rv
dist_ii = marg(ii,1);
switch dist_ii
case 1 % Normal distribution
bounds_ii = [-Inf, Inf];
case 2 % Lognormal distribution
bounds_ii = [0, Inf];
case 3 % Gamma distribution
case 4 % Shifted exponential distribution
case 5 % Shifted Rayleigh distribution
case 6 % Uniform distribution
a = marg(ii,5);
b = marg(ii,6);
bounds_ii = [a, b];
case 7 % Beta distribution
case 8 % Chi-square distribution
case 11 % Type I largest value distribution ( same as Gumbel distribution )
bounds_ii = [-Inf, Inf];
case 12 % Type I smallest value distribution
case 13 % Type II largest value distribution
case 14 % Type III smallest value distribution
case 15 % Gumbel distribution ( same as type I largest value distribution )
bounds_ii = [-Inf, Inf];
case 16 % Weibull distribution ( same as Type III smallest value distribution with epsilon = 0 )
case 18 % (Reserved for Laplace distribution)
case 19 % (Reserved for Pareto distribution)
case 20 % Generalized extreme value (GEV) distribution
case 30 % sample based custom distribution
case 31 % vector based custom distribution
ID = marg(ii,5);
load(['tmp\vector_distr_',num2str(ID),'.mat'], 'x_grid')
bounds_ii = [min(x_grid), max(x_grid)];
case 51 % Truncated normal marginal distribution
otherwise
error(['Unknown distribution type: ', dist_ii])
end
bounds(ii,:) = bounds_ii;
bounds_ii = [];
end
probdata.bounds = bounds;
end