summaryrefslogtreecommitdiff
path: root/2409/CH2/EX2.21/Ex2_21.sce
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /2409/CH2/EX2.21/Ex2_21.sce
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '2409/CH2/EX2.21/Ex2_21.sce')
-rwxr-xr-x2409/CH2/EX2.21/Ex2_21.sce37
1 files changed, 37 insertions, 0 deletions
diff --git a/2409/CH2/EX2.21/Ex2_21.sce b/2409/CH2/EX2.21/Ex2_21.sce
new file mode 100755
index 000000000..5e2fcafa4
--- /dev/null
+++ b/2409/CH2/EX2.21/Ex2_21.sce
@@ -0,0 +1,37 @@
+
+//Variable Declaration
+
+rI=-4685.3 //I component of radius vector from Example 2.16(km)
+rJ=5047.7 //J component of radius vector from Example 2.16(km)
+rK=-3289.1 //K component of radius vector from Example 2.16(km)
+aE=6378.1414 //Semimajor axis (km)
+eE=0.08182 //Eccentricity
+
+//Calculation
+
+r=sqrt(rI**2+rJ**2+rK**2)
+a=%pi //Guess value for LST(radians)
+b=atan(rK/rI) //Guess Value for latitude(radians)
+c=r-aE //Guess value for height(km)
+
+function [ans] = equations(p)
+ L = p(1)
+ h = p(2)
+ LST = p(3)
+ a = rI-((aE/sqrt(1-eE**2*sin(L)**2))+h)*cos(L)*cos(LST)
+ b = rJ-((aE/sqrt(1-eE**2*sin(L)**2))+h)*cos(L)*sin(LST)
+ c = rK-((aE*(1-eE**2)/sqrt(1-eE**2*sin(L)**2))+h)*sin(L)
+ ans = [a;b;c]
+endfunction
+
+ans = fsolve([b;c;a],equations)
+L = ans(1)
+h = ans(2)
+LST = ans(3)
+L= L*180/3.142 //Converting L into degrees
+h=round(h)
+LST=LST*180/3.142 //Converting LST into degrees
+
+printf("The latitude of subsatellite is %.2f degrees",L)
+printf("\nThe height of subsatellite is %.2f km",h)
+printf("\nThe LST of subsatellite is %.1f degrees",LST)