{VERSION 2 3 "IBM INTEL NT" "2.3" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 }{CSTYLE "" 0 21 "" 0 1 0 0 0 1 0 0 0 0 2 0 0 0 0 }{PSTYLE " Normal" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Maple Output" 0 11 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 3 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 0 "" 0 "" {TEXT -1 18 "EulerAng 6/23/97" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 71 "Show the \+ effect of a rotation matrix on a vector as a function of time." }} {PARA 0 "" 0 "" {TEXT -1 68 "In particular, implement the euler angle \+ rotations and animate them." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 61 "Viewing is done along a polar (Pol) and azimuth al (Az) angle." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 79 "Initial angles theta, phi, and psi are specified, and rot ation rates for all 3." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 64 "The calculation starts from body x3,y3,z3 components , and works " }}{PARA 0 "" 0 "" {TEXT -1 68 "backward to the space xyz coordinates. When x,y,z are known for each" }}{PARA 0 "" 0 "" {TEXT -1 66 "body axis, a projection is done into the viewing direction, and an" }}{PARA 0 "" 0 "" {TEXT -1 18 "animation is made." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 35 "Forward rotation thr u angle a gives" }}{PARA 0 "" 0 "" {TEXT -1 38 "xnew = xold cos(a) + y old sin(a), etc." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "restart;wit h(plots):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "with(linalg): " }}}{EXCHG {PARA 0 "" 0 "" {MPLTEXT 0 21 30 "m1 is forward rotation t hru x." }}{PARA 0 "" 0 "" {TEXT -1 28 "new coords = m1 * old coords" } }{PARA 0 "" 0 "" {TEXT -1 19 "ditto for m2 and m3" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 59 "m1:=matrix([[1,0,0],[0,cos(x),sin(x)],[0,-si n(x),cos(x)]]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 59 "m2:=matr ix([[cos(x),0,sin(x)],[0,1,0],[-sin(x),0,cos(x)]]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 59 "m3:=matrix([[cos(x),sin(x),0],[-sin(x),co s(x),0],[0,0,1]]);" }}}{EXCHG {PARA 0 "" 0 "" {MPLTEXT 0 21 47 "We sta rt with body'x axes in x3,y3,z3 system as" }}{PARA 0 "" 0 "" {TEXT -1 74 "(1,0,0) for x axis, etc. To get to components in original space xy z system" }}{PARA 0 "" 0 "" {TEXT -1 79 "we must do a reverse rotation thru -psi, then reverse thru -theta, then reverse" }}{PARA 0 "" 0 "" {TEXT -1 79 "thru -phi. This will lead us to the xyz components of the body's axes after the" }}{PARA 0 "" 0 "" {TEXT -1 30 "body has been r otated in space" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "r1:=subs (x=-phi,evalm(m3));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "r2:= subs(x=-theta,evalm(m1));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "r3:=subs(x=-psi,evalm(m3));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "r123:=evalm(r1 &* r2 &* r3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "v1:=matrix([[f1],[f2],[f3]]);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 22 "vx:=evalm(r123 &* v1);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 37 "vz:=subs(psi=0,theta=Pi/8,evalm(vx));" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "p0:=[0,0];" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 70 "pL:=[-a*sin(Az)+b*cos(Az),-cos(Pol)*(a*cos(Az)+b *sin(Az))+c*sin(Pol)];" }}}{EXCHG {PARA 0 "" 0 "" {MPLTEXT 0 21 51 "Vi ewing angles are set up here, polar and azimuthal" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 34 "viewsubs:=\{Pol=2*Pi/10,Az=1*Pi/4\};" }}} {EXCHG {PARA 0 "" 0 "" {MPLTEXT 0 21 47 "Now set up the view and plots of the x,y,z axes" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "ax:=s ubs(a=1,b=0,c=0,viewsubs,pL):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "ay :=subs(a=0,b=1,c=0,viewsubs,pL):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "az:=subs(a=0,b=0,c=1,viewsubs,pL):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "zax:=plot([p0,az],color=black,axes=NONE,scaling=constrained):" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "xax:=plot([p0,ax],color=black,axes= NONE,scaling=constrained):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "yax:= plot([p0,ay],color=black,axes=NONE,scaling=constrained):" }}}{EXCHG {PARA 0 "" 0 "" {MPLTEXT 0 21 52 "Now set up the view of lines which h ave been rotated" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 43 "p1:=sub s(a=vx[1,1],b=vx[2,1],c=vx[3,1],pL):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "p:=subs(viewsubs,p1):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "px:= subs(f1=1,f2=0,f3=0,p):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "py:=subs (f1=0,f2=1,f3=0,p):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "pz:=subs(f1= 0,f2=0,f3=1,p):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "Nframes: =35;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "Psidot:=2*Pi/18; Thetadot:= 0;Phidot:=2*Pi/36;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "Theta0:=Pi/12 ;Phi0:=0;Psi0:=0;" }}{PARA 11 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "for i from 0 to Nframes do" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 67 "sbs:=\{theta=Theta0+i*Thetadot,phi=Phi0+i*Phidot ,psi=Psi0+i*Psidot\}:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 85 "gx.(i):=pl ot(subs(sbs,[p0,px]),color=blue,scaling=constrained,thickness=3,axes=N ONE):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 84 "gy.(i):=plot(subs(sbs,[p0, py]),color=red,scaling=constrained,thickness=3,axes=NONE):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 86 "gz.(i):=plot(subs(sbs,[p0,pz]),thickness=3, color=black,scaling=constrained,axes=NONE):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 55 "m.(i):=display(\{gx.(i),gy.(i),gz.(i),xax,yax,zax\}): od:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 42 "display([m.(0..Nfra mes)],insequence=true);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 " " }}}}{MARK "25 0 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 }