{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 6: Photogrammetry" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.10: 79.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "S=1.0/10000;//scale\n", "A=500.0;//area in sq. km\n", "pw=0.3;//side overlap\n", "l=0.23;//length in mm\n", "w=0.23;//width in mm\n", "//calculation\n", "a=(1-0.6)*(1-pw)*l*w/S**2/1000/1000;\n", "N=A/a;\n", "disp(round(N),'no. of photographs taken')\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.11: 80.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "L=25.0e3;//length in m\n", "k=0.23e4;//l/s=w/s;\n", "pl=0.6;//longitudinal lap\n", "pw=0.3;//side lap\n", "W=20.0e3;//width in m\n", "//calculation\n", "N=((L/((1-pl)*k)+1))*((W/((1-pw)*k)+1)+1);\n", "disp(N,'no. of photographs taken');\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.12: 81.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "//Part A page 310\n", "f=0.1524;//focal length\n", "S=1.0/10000;//scale\n", "pw=0.3;//side lap\n", "w=0.23;//format width\n", "pl=0.6;\n", "l=0.23;\n", "//calculation\n", "W=(1-pw)/S*w;\n", "H=f/S+300;\n", "disp(H,'height over datum in m');\n", "N2=30/W+1;\n", "N2=round(N2)\n", "disp(N2-1,'no. of flight strips');\n", "L=(1-pl)*1/S*l/1000;\n", "disp(L,'length of each photograph cover in km');\n", "T=3600*L/240.0;\n", "disp(round(T),'exposure time in s');\n", "Ad=T*240e3/60.0/60.0;//adjusted ground distance\n", "N1=40.0e3/Ad+1;\n", "N1=round(N1)\n", "N=N1*N2;\n", "disp(N,'no. of photographs taken');\n", "//Part b page 317\n", "t=3.0/180*%pi;\n", "ya=82.25;\n", "xa=-62.45;\n", "s=220;\n", "f=152.4;//focal length\n", "H=2500.0e3;\n", "h=500.0e3;\n", "//calculation\n", "theta=s-180;\n", "ya_dash=xa*sin(theta*%pi/180)+ya*cos(theta*%pi/180)+f*tan(t)\n", "S=(f/cos(t)-ya_dash*sin(t))/(H-h);\n", "disp(round(1/S),'scale of photograph in 1 in')\n", "disp('answer varies slightly due to round off error')\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.13: 82.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "t=3*%pi/180;//tilt\n", "xa=-62.45;//x coordinate of a\n", "xb=78.25;//x coorbinate of b\n", "f=152.4;//focal length in mm\n", "H=2500.0;//actual height in m\n", "hb=800;//height B in m\n", "ha=500.0;//height A in m\n", "ya=82.25;//y coordinate of a\n", "yb=-41.15;//y coordinate of b\n", "s=220.0;\n", "//calculation\n", "theta=s-180;\n", "ya1=xa*sin(theta*%pi/180)+ya*cos(theta*%pi/180)+f*tan(t);//ya'\n", "xa1=xa*cos(theta*%pi/180)-ya*sin(theta*%pi/180);//xa'\n", "xb1=xb*cos(theta*%pi/180)-yb*sin(theta*%pi/180);//xb'\n", "yb1=xb*sin(theta*%pi/180)+yb*cos(theta*%pi/180)+f*tan(t);//yb'\n", "Xa=xa1*(H-ha)/(f/cos(t)-ya1*sin(t));\n", "Xb=xb1*(H-hb)/(f/cos(t)-yb1*sin(t));\n", "Ya=ya1*cos(t)*(H-ha)/(f/cos(t)-ya1*sin(t));\n", "Yb=yb1*cos(t)*(H-hb)/(f/cos(t)-yb1*sin(t));\n", "AB=sqrt((Xb-Xa)**2+(Yb-Ya)**2);\n", "disp(AB,'distance of AB in m')\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.14: 83.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "ri=95.0;//radial distance in mm\n", "f=152.4;//focal length in mm\n", "t=3*%pi/180;//tilt\n", "l=50*%pi/180;//angle\n", "//calculation\n", "dt=ri**2*sin(t)*cos(l)**2/(f-ri*sin(t)*cos(l));\n", "disp(round(dt*100)/100,'tilt displacement of the image in mm')\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.15: 84.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "d=230.0;//square side in mm\n", "f=152.4//focal length in mm\n", "pl=0.6;//end lap\n", "//calculation\n", "k=(1-pl)*d/f;\n", "V=k/0.15;\n", "disp(V,'vertical exaggeration is')\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.16: 85.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "xa=51.23;//x coordinate of a\n", "xb=91.48;//x coordinate of b\n", "ya=48.33;//y coordinate of a\n", "yb=-51.63;//y coordinate of b\n", "f=152.4;//focal length in mm\n", "B=425.0;//actual height in mm\n", "hb=842.86//height B in mm\n", "ha=820.97;//height A in mm\n", "r1=10.42;//in mm\n", "r2=9.67;//in mm\n", "b1=89.12;//base in mm\n", "b=89.43;//base in mm\n", "ra=11.62;//parallax in mm\n", "rb=14.53;//parallax in mm\n", "//calculation\n", "C=0.5*((b1-r1)+(b-r2))\n", "pa=C+ra;\n", "pb=C+rb;\n", "Xa=B*xa/pa;\n", "Xb=xb*B/pb;\n", "Ya=ya*B/pa;\n", "Yb=yb*B/pb;\n", "AB=sqrt((Xb-Xa)**2+(Yb-Ya)**2);\n", "disp(AB,'distance of AB in m')\n", "disp('the answer does not match with textbook due to round off error')\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.1: 70.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "Da=184.32;//distance in mm\n", "Db=95.84;//distance in mm\n", "Ax=-115.0;//x coordinate of A\n", "By=-115.0;//y coordinate of B\n", "//calculation\n", "phi=atan(Ax/By);\n", "AB=sqrt(Ax**2+By**2);\n", "theta=acos((Da**2+AB**2-Db**2)/2/Da/AB);\n", "alpha=phi-theta;\n", "xc=Da*cos(alpha)-115.0;\n", "disp(xc,'the coordiantes in mm x is');\n", "yc=-Da*sin(alpha);\n", "disp(yc,'the coordiantes in mm y is');\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.17: 86.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "C=79.0;//in mm\n", "ra=11.42;//elevarion in image in mm\n", "rb=15.65;//elevarion in image in mm\n", "hb=651;//height of B in mm\n", "H=1500;//height in m\n", "//calculation\n", "delp=ra-rb;//pa=ra+c and pb=rb+c so ra-rb=pa-pb\n", "pa=ra+C;\n", "ha=hb+delp/pa*(H-hb);\n", "disp(ha,'height of A in m')\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.18: 77.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "B=741.0;//airbase in m\n", "f=152.4;//focal length in mm\n", "pa=94.32;//in mm\n", "ha=325;//elevation in mm\n", "//calculation\n", "H=ha+B*f/pa;\n", "disp(H,'height in m')\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.19: 88.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "H=1632.0;//above MSL in m\n", "f=152.4;//focal length in mm\n", "pa=82.75;//in mm\n", "ha=283;//elevation in m\n", "//calculation\n", "B=pa/f*(H-ha);\n", "disp(B,'width of air base in m')\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.20: 89.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "alpha=50.0;//angle in degrees\n", "beta=46.0;//angle in degrees\n", "f=300.0;//focal length in mm\n", "xa=24.0;//x coordinate of a\n", "xb=30.0;//x coordinate of b\n", "//calculation\n", "dela=xa/f;\n", "delb=xb/f;\n", "A=alpha+dela*180/%pi;//angle A\n", "B=beta-delb*180/%pi;//angle B\n", "D=180-A-B;\n", "AD=1300.0*sin(B*%pi/180)/sin(D*%pi/180);\n", "disp(round(AD),'distance of AD in m');\n", "Y=6/(sqrt(xa**2+f**2))*AD;\n", "RD=60.12+Y;\n", "disp(RD,'RL of D in m');\n", "disp('the answer varies slightly due to round off error');\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.21: 90.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "f=152.4;//focal length in mm\n", "L=120;//length in m\n", "x1=40.0;//distance in mm\n", "x2=-90.0;//distance in mm\n", "//calculation\n", "X=f*L/(x1-x2);\n", "disp(X,'the coordinates of D in m is X=')\n", "Y=L*x1/(x1-x2);\n", "disp(Y,'the coordinates of D in m is Y=')\n", "h=X*(30-20)/f;\n", "disp(h,'elevation of D in m')\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.22: 91.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "function[dms]=degtodms(deg)\n", " d = int(deg)\n", " md = abs(deg - d) * 60\n", " m = int(md)\n", " sd = (md - m) * 60\n", " sd=round(sd*100)/100;\n", " if sd==60.0 then\n", " sd=0;\n", " m=m+1;\n", " end\n", " dms=[d m sd]\n", "endfunction\n", "f=150.4;//focal length in mm\n", "xc=-32.43;//coordinate in mm\n", "xd=9.52;//coordinate in mm\n", "//calculation\n", "thc=atan(xc/f);\n", "thd=atan(xd/f);\n", "th=thd-thc;\n", "th=th*180/%pi;\n", "Az=325+15.0/60+th;\n", "Az=degtodms(Az);\n", "disp(Az,'Azimuth of D in deg,min,sec respectively')\n", "disp('the answer differs slightly due to round off error')\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.23: 92.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "BC=66.0;//distance in m\n", "AC=81.6;//distance in m\n", "xb=3.0;//x coordinate of b\n", "ya=1.25;//y coordinate of a\n", "xa=3.3;//x coordinate of a\n", "theta=23+43.0/60;//angle in degrees\n", "//calculation\n", "f=(xa+xb)/2/tan(theta*%pi/180)+sqrt((xa+xb)**2/4/(tan(theta*%pi/180))**2+xa*xb);\n", "disp(round(f),'focal length in cm');\n", "aa=atan(ya/sqrt(xa**2+f**2));\n", "Va=AC*tan(aa);\n", "ab=atan(-1.87/sqrt(xa**2+f**2));\n", "Vb=-BC*tan(ab);\n", "disp(round((Vb+Va)*100)/100,'horizontal distance in m');\n", "disp('the answer varies slightly due to round off error');\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.24: 93.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "Eab=300.0;//average elevation\n", "f=152.4;//focal length in mm\n", "xa=28.4;//x coordinate of a\n", "xb=-22.5;//x coordinate of b\n", "ya=24.5;//y coordinate of a\n", "yb=38.4;//y coordinate of b\n", "Ha=2322.0;//distance in m\n", "ha=400.0;//elevation of a in m\n", "hb=200.0;//elevation of b in m\n", "ab=61.05;//distance in mm\n", "AB=810;//ground length in m\n", "//calculation\n", "Ha=300+AB/ab*f;\n", "Xa=round((Ha-ha)*100/f*xa)/100;\n", "Xb=round((Ha-ha)*100/f*xb)/100;\n", "Ya=round((Ha-hb)*100/f*ya)/100;\n", "Yb=round((Ha-hb)*100/f*yb)/100;\n", "AB=sqrt((Xa-Xb)**2+(Ya-Yb)**2);\n", "disp(round(AB*100)/100,'length AB in m');\n", "H=300+810/AB*(Ha-Eab);\n", "Xa=(H-ha)/f*xa;\n", "Xb=(H-ha)/f*xb;\n", "Ya=(H-hb)/f*ya;\n", "Yb=(H-hb)/f*yb;\n", "AB1=sqrt((Xa-Xb)**2+(Ya-Yb)**2);\n", "disp(AB1,'corrected length AB in m');\n", "disp(round(H*1000)/1000,'flying height in m');\n", "//Xb is calculated wrong in the book that resulted in the error-\n", "clear()\n", "" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.25: 94.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "AB=300.0;//length in m\n", "ab=102.4;//distance in mm\n", "f=152.4;//focal length in mm\n", "hab=320.0;//average elevation in m\n", "d=7.8;//dispalcement in mm\n", "r=75.4;//distance in mm\n", "//calculation\n", "H=hab+AB/ab*f;\n", "h=d*H/r;\n", "disp(h,'height difference in m')\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.26: 95.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "f=152.4;//focal length in mm\n", "b=74.25;//distance in mm\n", "ht=100.0;//height in m\n", "H=700.0;//flying height\n", "//calculation\n", "B=b*H/f;\n", "pb=f*B/H;\n", "pt=f*B/(H-ht);\n", "delp=pt-pb;\n", "disp(round(delp*100)/100,'error due to parallax in mm')\n", "ht=delp/pt*(H);\n", "disp(ht,'height of chimney in m')\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.2: 71.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "f=0.152;//focal length in m\n", "H=1800;//elevation of topmost point in m\n", "h=300;//elevation of ground in m\n", "//calculation\n", "S=f/(H-h);\n", "disp(round(1/S),'scale of photograph in 1 in')\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.27: 96.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "B=180.0;//height in m\n", "f=120.0;//focal length in mm\n", "pa=54.32//parallax in mm\n", "pb=46.35;//parallax in m\n", "//calculation\n", "delH=B*f/pa/pb*(pa-pb);\n", "disp(delH,'height difference in m')\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.28: 97.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "L1=30000.0;//length in m\n", "pl=0.6;//overlap\n", "k=12000.0*0.2;//=l/S and w/S\n", "pw=0.3;//side lap\n", "W1=24000;//width in m\n", "//calculation\n", "N=round(((L1/((1-pl)*k)+1)+1))*round(((W1/((1-pw)*k)+1)+1));\n", "disp(N,'no. of photographs taken');\n", "Nf=N/33-1;//flight strips\n", "disp(Nf,'no. of flight strips');\n", "gd=(1-pl)*k;//grounf distance\n", "disp(gd,'ground distance in m');\n", "I=gd/(200e3)*60.0*60.0;//exposure interval\n", "disp(round(I),'exposure interval in s');\n", "ad=round(I)/60.0/60*200e3;//actual distance\n", "disp(ad,'actual distance in m');\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.3: 72.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "f=0.150 //focal length in m\n", "h1=1500.0;//elevation A in m\n", "h2=1200.0;//elevation B in m\n", "h3=1000.0;//elevation C in m\n", "H=3000.0;//height in m\n", "//calculstion\n", "hav=1.0/3*(h1+h2+h3);\n", "S1=f/(H-h1);\n", "disp(1/S1,'scale of point 1 in 1 in');\n", "S2=f/(H-h2);\n", "disp(1/S2,'scale of point 2 in 1 in');\n", "S3=f/(H-h3);\n", "disp(round(1/S3),'scale of point 3 in 1 in');\n", "Sav=f/(H-hav);\n", "disp(round(1/Sav),'average scale in 1 in');\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.4: 73.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "ab=188.0;//distance in m\n", "AB=120;//distance in m\n", "Sm=1.0/20000;\n", "//calculation\n", "S=ab/AB*Sm;\n", "disp(1/S,'scale of photograph in 1 in');\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.5: 74.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "xa=45.35;\n", "xb=-40.16;\n", "f=152.4;//focal length\n", "H=1500.0;//actual height\n", "ha=200.0;//height A\n", "hb=150.0;//height B\n", "ya=38.41;\n", "yb=-45.65;\n", "//calculation\n", "Xa=xa*(H-ha)/f;\n", "Ya=ya*(H-hb)/f;\n", "Xb=xb*(H-ha)/f;\n", "Yb=yb*(H-hb)/f;\n", "AB=sqrt((Xb-Xa)**2+(Yb-Ya)**2);\n", "disp(AB,'distance of AB in m');\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.6: 75.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "d=62.4;//displacement in mm\n", "H=250.0;//height of datum m\n", "r=115.4;//image distance in mm\n", "//calculation\n", "h=H*d/r;\n", "disp(h,'height of chimney in m')\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.7: 76.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "ra=88.25;//image distance of A in mm\n", "rb=81.23;//image distance of B in mm\n", "rc=68.14;//image distance of C in mm\n", "H=2000.0;// in m\n", "ha=255;//distance in m\n", "hb=200;//distance in m\n", "hc=145;//distance in m\n", "f=0.1524;//focal length in m\n", "//calculation\n", "aa=ra*ha/H;\n", "disp(aa,'relief distance of A in mm');\n", "bb=rb*hb/H;\n", "disp(bb,'relief distance of B in mm');\n", "cc=rc*hc/H;\n", "disp(cc,'relief distance of C in mm');\n", "S=f/H;\n", "disp(1/S,'scale of photograph in 1 in');\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.8: 77.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "f=0.1524;//focal length in m\n", "S=0.08251/1000;//scale\n", "//calculation\n", "H=f/S;\n", "disp(H,'flying height in m');\n", "clear()" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6.9: 78.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "clc; funcprot(0);\n", "// Initialization of Variable\n", "AB=610;// ground length in m\n", "Xa=18.35;//in mm\n", "Xb=106.41;//in mm\n", "Ya=-62.41;//in mm\n", "Yb=-21.43;//in mm\n", "Ha=435;//elevation in m\n", "Hb=452;//elevation in m\n", "f=0.1524*1000;//focal length in m\n", "//calculation\n", "//solving the quadratic polynomial in H\n", "//a=(Xb(H-Hb)-Xa(H-Ha))/f\n", "//b=(Yb(H-Hb)-Ya(H-Ha))/f\n", "//AB=sqrt(a^2+b^2)\n", "//0=0.4064-365.929H-289685.07\n", "//H=poly([-289685.926 -365.929 0.4064],'x','coeff')\n", "//h=roots(H)\n", "//disp(h(1),'height required in m')\n", "function [f]=equation(x)\n", " f=610^2-((Xb/f*(x-Hb)-Xa/f*(x-Ha))^2+(Yb/f*(x-Hb)-Ya/f*(x-Ha))^2)\n", "endfunction\n", "//initial guess\n", "x=1407;\n", "//deff('y=f(x)','y=f');\n", "y=fsolve(x,equation);\n", "disp(round(y),'height required in m')\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 }