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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
|
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Chapter 3: Trilateration"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 3.1: 4.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"\n",
"clc; funcprot(0);\n",
"// Initialization of Variable\n",
"AB=25145.32;//distance in m\n",
"R=6370.0e3;//radius of earth in m\n",
"ha=325.14;//elevation in m\n",
"//calculation\n",
"theta=AB*cos(3+9.0/60+40.0/3600)/R;\n",
"AB_dash=AB/sin(%pi/2+theta/2)*sin(%pi/2-theta/2-(3+9.0/60+40.0/3600)*%pi/180);\n",
"CD=AB_dash-AB_dash*ha/R;\n",
"S=CD+CD**3/24.0/R**2;\n",
"disp(S,'sea level length in m')\n",
"clear()\n",
"disp('answer varies slightly due to round off error')"
]
}
,
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 3.2: 5.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"\n",
"clc; funcprot(0);\n",
"// Initialization of Variable\n",
"AB=31325.14//slope distance in m\n",
"R=6370.0e3;//radius of earth\n",
"ha=1582.15;//elevation in m\n",
"h=4251.32-ha//in m\n",
"//calculation\n",
"AB_dash=AB-h**2/2/AB;\n",
"theta=2*asin(AB_dash/2/R);\n",
"AB_dash=AB-(h*sin(theta/2)+h**2/AB/2)\n",
"CD=AB_dash-AB_dash*ha/R;\n",
"S=CD+CD**3/24.0/R**2;\n",
"disp(S,'sea level length in m')\n",
"clear()"
]
}
,
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 3.3: 6.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"\n",
"clc; funcprot(0);\n",
"// Initialization of Variable\n",
"//alpha=A and beta=B and those are angles\n",
"AB=1525.456;//distance in m\n",
"BC=2176.945;//distance in m\n",
"CD=1697.435;//distance in m\n",
"AD=2401.435;//distance in m\n",
"AC=3073.845;//distance in m\n",
"BD=2483.115;//distance in m\n",
"//calculation\n",
"A1=acos((CD**2+AC**2-AD**2)/(2*CD*AC));\n",
"A1=A1*180/%pi;\n",
"A2=acos((AD**2+BD**2-AB**2)/(2*AD*BD));\n",
"A2=A2*180/%pi;\n",
"A3=acos((AB**2+AC**2-BC**2)/(2*AB*AC));\n",
"A3=A3*180/%pi;\n",
"A4=acos((BC**2+BD**2-CD**2)/(2*BC*BD));\n",
"A4=A4*180/%pi;\n",
"B1=acos((CD**2+BD**2-BC**2)/(2*CD*BD));\n",
"B1=B1*180/%pi;\n",
"B2=acos((AD**2+AC**2-CD**2)/(2*AD*AC));\n",
"B2=B2*180/%pi;\n",
"B3=acos((AB**2+BD**2-AD**2)/(2*AB*BD));\n",
"B3=B3*180/%pi;\n",
"B4=acos((AC**2+BC**2-AB**2)/(2*AC*BC));\n",
"B4=B4*180/%pi;\n",
"e1=360-A1-A2-A3-A4-B1-B2-B3-B4;//error\n",
"e2=A1+B1-A3-B3;//error\n",
"e3=A2+B2-A4-B4;//error\n",
"//angle update\n",
"A1=A1+e1/8-e2/4;\n",
"A3=A3+e1/8+e2/4;\n",
"B1=B1+e1/8-e2/4;\n",
"B3=B3+e1/8+e2/4;\n",
"A2=A2+e1/8-e3/4;\n",
"B2=B2+e1/8-e3/4;\n",
"A4=A4+e1/8+e3/4;\n",
"B4=B4+e1/8+e3/4;\n",
"//updating sides\n",
"AD=1525.456*sin(B3*%pi/180)/sin(A2*%pi/180);\n",
"disp('equation for B2 is wrong')\n",
"disp(AD,'corrected length of AD in m')\n",
"BD=1525.456*sin(A3*%pi/180+B2*%pi/180)/sin(A2*%pi/180);\n",
"disp(BD,'corrected length of BD in m')\n",
"AC=1525.456*sin(A4*%pi/180+B3*%pi/180)/sin(B4*%pi/180);\n",
"disp(AC,'corrected length of AC in m')\n",
"BC=1525.456*sin(A3*%pi/180)/sin(B4*%pi/180);\n",
"disp(BC,'corrected length of BC in m')\n",
"CD=BC*sin(A4*%pi/180)/sin(B1*%pi/180)\n",
"disp(CD,'corrected length of CD in m')\n",
"disp('answers differ slightly due to value of pi');\n",
"//equation for B2 is wrong\n",
"clear()"
]
}
,
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 3.4: 7.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"\n",
"clc; funcprot(0);\n",
"// Initialization of Variable\n",
"//angles found by cosine law\n",
"//alpha=A and beta=B and those are angles\n",
"A1=45.801596;//distance in m\n",
"A2=40.605250;//distance in m\n",
"A3=50.143258;//distance in m\n",
"A4=43.077646;//distance in m\n",
"B1=48.779868;//distance in m\n",
"B2=44.141587;//distance in m\n",
"B3=49.733152;//distance in m\n",
"B4=37.737035;//distance in m\n",
"//calculation\n",
"e1=360-A1-A2-A3-A4-B1-B2-B3-B4;//error\n",
"//angle update\n",
"A1=A1+e1/8;\n",
"A3=A3+e1/8;\n",
"B1=B1+e1/8;\n",
"B3=B3+e1/8;\n",
"A2=A2+e1/8;\n",
"B2=B2+e1/8;\n",
"A4=A4+e1/8;\n",
"B4=B4+e1/8;\n",
"E2=(log(sin(A1*%pi/180))*log(sin(A2*%pi/180))*log(sin(A3*%pi/180))*log(sin(A4*%pi/180))-log(sin(B1*%pi/180))*log(sin(B2*%pi/180))*log(sin(B3*%pi/180))*log(sin(B4*%pi/180)))/log(10000);\n",
"c3=E2/17.1;\n",
"c4=E2/17.0;\n",
"A1=A1-c3;\n",
"disp(A1,'corrected angle A1 in degrees')\n",
"B1=B1+c3;\n",
"disp(B1,'corrected angle B1 in degrees')\n",
"clear()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Scilab",
"language": "scilab",
"name": "scilab"
},
"language_info": {
"file_extension": ".sce",
"help_links": [
{
"text": "MetaKernel Magics",
"url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
}
],
"mimetype": "text/x-octave",
"name": "scilab",
"version": "0.7.1"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
|