{ "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 }