-
Notifications
You must be signed in to change notification settings - Fork 0
/
Random_Generation_of_Migrants.m
136 lines (128 loc) · 5.21 KB
/
Random_Generation_of_Migrants.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
function [Source_Country, num_Migrants] = Random_Generation_of_Migrants(Source_Country, total_num)
num_Migrants = [0, 0, 0, 0, 0, 0]; %population of migrants from 6 source countries
for i = 1:total_num
i
num = rand(1, 1);
year = 0;
Years_of_education = rand(1, 1) * 100;
if num >= 0 && num <= 0.024 %Nigrea
if Years_of_education >= 0 && Years_of_education <= 55
year = 0;
else
if Years_of_education > 55 && Years_of_education <= 63
year = (Years_of_education - 55);
else
if Years_of_education > 63 && Years_of_education <= 84
year = (Years_of_education - 63) * 4 / 21 + 8;
else
if Years_of_education > 84 && Years_of_education <= 100
year = (Years_of_education - 84) * 8 / 16 + 12;
end
end
end
end
num_Migrants(4) = num_Migrants(4) + 1;
Source_Country(1, i) = year;
Source_Country(5, i) = 4;
end
if num > 0.024 && num <= 0.069 %Eritrea
if Years_of_education >= 0 && Years_of_education <= 55
year = 0;
else
if Years_of_education > 55 && Years_of_education <= 63
year = (Years_of_education - 55);
else
if Years_of_education > 63 && Years_of_education <= 84
year = (Years_of_education - 63) * 4 / 21 + 8;
else
if Years_of_education > 84 && Years_of_education <= 100
year = (Years_of_education - 84) * 8 / 16 + 12;
end
end
end
end
num_Migrants(2) = num_Migrants(2) + 1;
Source_Country(1, i) = year;
Source_Country(5, i) = 2;
end
if num > 0.069 && num <= 0.629 %Syria
if Years_of_education >= 0 && Years_of_education <= 4
year = 0;
else
if Years_of_education > 4 && Years_of_education <= 16
year = Years_of_education - 4;
else
if Years_of_education > 16 && Years_of_education <= 59
year = (Years_of_education - 16) * 4 / 43 + 8;
else
if Years_of_education > 59 && Years_of_education <= 100
year = (Years_of_education - 59) * 8 / 42 + 12;
end
end
end
end
num_Migrants(6) = num_Migrants(6) + 1;
Source_Country(1, i) = year;
Source_Country(5, i) = 6;
end
if num > 0.629 && num <= 0.868 %Afgn
if Years_of_education >= 0 && Years_of_education <= 6
year = 0;
else
if Years_of_education > 6 && Years_of_education <= 29
year = (Years_of_education - 6) * 8 / 23;
else
if Years_of_education > 29 && Years_of_education <= 79
year = (Years_of_education - 29) * 4 / 50 + 8;
else
if Years_of_education > 79 && Years_of_education <= 100
year = (Years_of_education - 79) * 8 / 21 + 12;
end
end
end
end
num_Migrants(1) = num_Migrants(1) + 1;
Source_Country(1, i) = year;
Source_Country(5, i) = 1;
end
if num > 0.868 && num <= 0.897 %Pakistan
if Years_of_education >= 0 && Years_of_education <= 40
year = 0;
else
if Years_of_education > 40 && Years_of_education <= 46
year = (Years_of_education - 40) * 8 / 6;
else
if Years_of_education > 46 && Years_of_education <= 81
year = (Years_of_education - 46) * 4 / 35 + 8;
else
if Years_of_education > 81 && Years_of_education <= 100
year = (Years_of_education - 81) * 8 / 19 + 12;
end
end
end
end
num_Migrants(5) = num_Migrants(5) + 1;
Source_Country(1, i) = year;
Source_Country(5, i) = 5;
end
if num > 0.897 && num <= 1 %Iraq
if Years_of_education >= 0 && Years_of_education <= 56
year = 0;
else
if Years_of_education > 56 && Years_of_education <= 59
year = (Years_of_education - 56) * 8 / 6;
else
if Years_of_education > 59 && Years_of_education <= 72
year = (Years_of_education - 59) * 4 / 13 + 8;
else
if Years_of_education > 72 && Years_of_education <= 100
year = (Years_of_education - 72) * 8 / 28 + 12;
end
end
end
end
num_Migrants(3) = num_Migrants(3) + 1;
Source_Country(1, i) = year;
Source_Country(5, i) = 3;
end
end