Download presentation
Presentation is loading. Please wait.
Published byMoses Walker Modified over 9 years ago
1
5. Math1 Agenda r 1. Tools r 2. Matrices r 3. Least squares r 4. Propagation of variances r 5. Geometry
2
5. Math2 1. Tools rExcel rMatlab rMathcad rLabview 1. Tools
3
5. Math3 Excel rSpreadsheet rReadily available rSolver functions 1. Tools
4
5. Math4 Matlab rMatrix based rPowerful analytical tool rHandles transforms well rEasy to program 1. Tools
5
5. Math5 Mathcad rMathematical tool rEvolving into handling transfer functions rHas special programming language rDocumentation closer to real math 1. Tools
6
5. Math6 Labview rPowerful analysis tool rUses graphical language to translate concepts into C-code and then execute 1. Tools
7
5. Math7 2. Matrices (1 of 2) rAddition rSubtraction rMultiplication rVector, dot product, & outer product rTranspose rDeterminant of a 2x2 matrix rCofactor and adjoint matrices rDeterminant rInverse matrix 2. Matrices
8
5. Math8 Matrices (2 of 2) rOrthogonal matrix rHermetian matrix rUnitary matrix 2. Matrices
9
5. Math9 Addition (1 of 2) c IJ = a IJ + b IJ 1 -1 0 -2 1 -3 2 0 2 1 -1 -1 0 4 2 -1 0 1 A=B= 2 -2 -1 -2 5 -1 1 0 3 C= C=A+B 2. Matrices
10
5. Math10 Addition (2 of 2) Matrix addition using Excel 2. Matrices
11
5. Math11 Subtraction (1 of 2) c IJ = a IJ - b IJ 1 -1 0 -2 1 -3 2 0 2 1 -1 -1 0 4 2 -1 0 1 A=B= 0 0 1 -2 -3 -5 3 0 1 C= C=A-B 2. Matrices
12
5. Math12 Subtraction (2 of 2) Matrix subtraction using Excel 2. Matrices
13
5. Math13 Multiplication (1 of 2) c IJ = a I1 * b 1J + a I2 * b 2J + a I3 * b 3J 1 -1 0 -2 1 -3 2 0 2 1 -1 -1 0 4 2 -1 0 1 A=B= 1 -5 -3 1 6 1 0 -2 0 C= C=A*B 2. Matrices
14
5. Math14 Multiplication (2 of 2) Matrix multiplication using Excel 2. Matrices
15
5. Math15 Transpose (1 of 3) b IJ = a JI 1 -1 0 -2 1 -3 2 0 2 1 -2 2 -1 1 0 0 -3 2 A=B= B=A T 2. Matrices
16
5. Math16 Transpose (2 of 3) Matrix transpose using Excel 2. Matrices
17
5. Math17 Transpose (3 of 3) r(AB) T = B T A T 1 -1 0 -2 1 -3 2 0 2 1 -1 -1 0 4 2 -1 0 1 A=B= 1 1 0 -5 6 -2 -3 1 0 (AB) T = 1 -2 2 -1 1 0 0 -3 2 1 0 -1 -1 4 0 -1 2 1 A T = B T =B T A T = 1 1 0 -5 6 -2 -3 1 0 2. Matrices
18
5. Math18 Vector, dot & outer products (1 of 2) rA vector v is an N x 1 matrix rDot product = inner product = v T x v = a scalar rOuter product = v x v T = N x N matrix 2. Matrices
19
5. Math19 Vector, dot & outer products (2 of 2) Matrix inner and outer products using Excel 2. Matrices
20
5. Math20 Determinant of a 2x2 matrix 2x2 determinant = b 11 * b 22 - b I2 * b 21 B= 1 -1 -2 1 = -1 2. Matrices
21
5. Math21 Cofactor and adjoint matrices 1 -1 0 -2 1 -3 2 0 2 A= 1 -3 0 2 -1 0 0 2 -1 0 0 -3 -2 -3 2 2 1 0 2 2 1 0 -2 -3 -2 1 2 0 1 -1 2 0 1 -1 -2 1 2 -2 -2 2 2 -2 3 3 -1 =B = cofactor = 2 2 3 -2 2 3 -2 -2 -1 C=B T = adjoint= 2. Matrices - - - -
22
5. Math22 Determinant 1 -1 0 -2 1 -3 2 0 2 determinant of A = The determinant of A = dot product of any row in A times the corresponding column in the adjoint matrix = dot product of any row (or column) in A times the corresponding row (or column) in the cofactor matrix The determinant of A = dot product of any row in A times the corresponding column in the adjoint matrix = dot product of any row (or column) in A times the corresponding row (or column) in the cofactor matrix 1 -1 0 =4 2 -2 = 4 2. Matrices
23
5. Math23 Inverse matrix (1 of 3) B = A -1 =adjoint(A)/determinant(A) = 0.5 0.5 0.75 -0.5 0.5 0.75 -0.5 -0.5 -0.25 1 -1 0 -2 1 -3 2 0 2 0.5 0.5 0.75 -0.5 0.5 0.75 -0.5 -0.5 -0.25 1 0 0 0 1 0 0 0 1 = 2. Matrices Inverse
24
5. Math24 Inverse matrix (2 of 3) Matrix inverse using Excel 2. Matrices
25
5. Math25 Inverse matrix (3 of 3) r(AB) -1 = B -1 A -1 1 -1 0 -2 1 -3 2 0 2 1 -1 -1 0 4 2 -1 0 1 A=B= 0.25 0.75 1.625 0 0 -0.5 -0.25 0.35 1.375 (AB) -1 = 0.5 0.5 0.75 -0.5 0.5 0.75 -0.5 -0.5 -0.25 A -1 = B -1 = B -1 A -1 = 0.25 0.75 1.625 0 0 -0.5 -0.25 0.35 1.375 2 0.5 1 -1 0 -1 2 0.5 2 Inverse of a product 2. Matrices
26
5. Math26 Orthogonal matrix rAn orthogonal matrix is a matrix whose inverse is equal to its transpose. 1 0 0 0 cos sin 0 -sin cos 1 0 0 0 cos -sin 0 sin cos 1 0 0 0 1 0 0 0 1 = 2. Matrices
27
5. Math27 Hermetian matrix (1 of 3) rA Hermetian matrix is a matrix that is equal to its own Hermetian transpose A = A H rThe Hermetian transpose of A is the complex conjugate transpose of A A H = A T Hermetian matrix 2. Matrices
28
5. Math28 Hermetian matrix (2 of 3) 1 1-I 2 1+I 3 i 2 -i 0 A = 1 1+I 2 1-I 3 - i 2 +i 0 A T = 1 1-I 2 1+I 3 i 2 -i 0 = A Example 2. Matrices
29
5. Math29 Hermetian matrix (3 of 3) Hermetian matrix using Excel 2. Matrices
30
5. Math30 Unitary matrix rA matrix is unitary if its inverse equals its Hermetian transpose U -1 = U H rDFT and inverse DFT are unitary matrices 2. Matrices
31
5. Math31 3. Least squares rExample 1 rExample 2 3. Least squares
32
5. Math32 Example 1 (1 of 9) x + 2y + 3z = 14 -2x + + z = 1 2x + y = 4 1 2 3 -2 0 1 2 1 0 A = -1 3 2 2 -6 -7 -2 3 4 A -1 = -1/3 b = 14 1 4 xyzxyz = A -1 b = 1 2 3 Solve 3 equations and 3 unknowns 3. Least squares
33
5. Math33 Example 1 (2 of 9) x + 2y + 3z = 14 -2x + + z = 1 2x + y = 4 3x + y - z = 2 xyzxyz = 1 2 3 x + 2y + 3z = 13 -2x + + z = 1 2x + y = 4 3x + y - z = 3 xyzxyz = ? What happens if we have 4 equations and 3 unknowns 3. Least squares
34
5. Math34 Example 1 (3 of 9) e 1 = x + 2y + 3z - 13 e 2 = -2x + + z - 1 e 3 = 2x + y - 4 e 4 = 3x + y - z - 3 Minimize J = (e 1 2 + e 2 2 + e 3 2 + e 4 2 ) Minimize the sum of squares 3. Least squares
35
5. Math35 Example 1 (4 of 9) Solve using Solver in Excel 3. Least squares
36
5. Math36 Example 1 (5 of 9) e 1 = x + 2y + 3z - 13 e 2 = -2x + + z - 1 e 3 = 2x + y - 4 e 4 = 3x + y - z - 3 A = 1 2 3 -2 0 1 2 1 0 3 1 1 b = 13 1 4 3 A T A s = A T bs = [A T A] -1 A T b = xyzxyz = 0.46 3.37 1.91 Solve using matrices 3. Least squares
37
5. Math37 Example 1 (6 of 9) A = a 1x a 1y a 1z a 2x a 2y a 2z a 3x a 3y a 3z a 4x a 4y a 4z b = b 1 b 2 b 3 b 4 a 1x a 2x a 3x a 4x a 1y a 2y a 3y a 4y a 1z a 2z a 3z a 4z A T = a kx a kx a ky a kx a kz a kx a kx a ky a ky a ky a kz a ky a kx a kz a ky a kz a kz a kz a 1x a 2x a 3x a 4x a 1y a 2y a 3y a 4y a 1z a 2z a 3z a 4z a 1x a 1y a 1z a 2x a 2y a 2z a 3x a 3y a 3z a 4x a 4y a 4z A T A = = Express matrix solution in more general terms 3. Least squares
38
5. Math38 Example 1 (7 of 9) A T b = a kx b k a kz b k Express matrix solution in more general terms (cont) 3. Least squares
39
5. Math39 Example 1 (8 of 9) J = [a 1x x + a 1y y + a 1z z - b 1 ] 2 + [a 2x x + a 2y y + a 2z z - b 2 ] 2 + [a 3x x + a 3y y + a 3z z - b 3 ] 2 + [a 4x x + a 4y y + a 4z z - b 4 ] 2 J/ x = 2[a 1x a 1x x + a 1y a 1x y + a 1z a 1x z - a 1x b 1 ] + [a 2x a 2x x + a 2y a 2x y + a 2z a 2x z - a 2x b 2 ] + [a 3x a 3x x + a 3y a 3x y + a 3z a 3x z - a 3x b 3 ] + [a 4x a 4x x + a 4y a 4x y + a 4z a 4x z - a 4x b 4 ] 2[ a kx a kx x a ky a kx y a kz a kx z - a kx b k ] = 0 Minimize by calculus 3. Least squares
40
5. Math40 Example 1 (9 of 9) a kx a kx x a ky a kx y a kz a kx z - a kx b k = 0 a kx a ky x a ky a ky y a kz a ky z - a ky b k = 0 a kx a kz x a ky a kz y a kz a kz z - a kz b z = 0 a kx a kx a ky a kx a kz a kx a kx a ky a ky a ky a kz a ky a kx a kz a ky a kz a kz a kz xyzxyz - = 0 a kx b k a ky b k a kz b k Minimize by calculus (continued) 3. Least squares
41
5. Math41 Example 2 (1 of 3) 1.1000 1.9000 2.9000 4.0000 5.0000 6.0000 x = 2.2000 3.0000 4.1000 5.0000 6.1000 6.9000 y = Fit a curve to the following data 3. Least squares
42
5. Math42 Example 2 (2 of 3) Fit z = a + b x i + c x i 2 A = [[1;1;1;1;1;1], x, x.*x] = abcabc = (A T A) -1 A T b b = y = 1.0126 1.0949 -0.0184 1.0000 1.1000 1.2100 1.0000 1.9000 3.6100 1.0000 2.9000 8.4100 1.0000 4.0000 16.0000 1.0000 5.0000 25.0000 1.0000 6.0000 36.0000 Fit curve z to data 3. Least squares
43
5. Math43 Example 2 (3 of 3) error = a + b x + c x 2 - y = -0.0052 0.0266 -0.0668 0.0980 -0.0726 0.0200 Error in curve fit 3. Least squares
44
5. Math44 4. Propagation of variance rCombining variance rMultiple dimensions rExample -- propagation of position rExample -- angular rotation 4. Propagation of variables
45
5. Math45 Combining variances rVariances from multiple error sources can be combined by adding variances r Example x orig = standard deviation in original position = 1 m v orig = standard deviation in original velocity = 0.5 m/s T = time between samples = 2 sec x current = error in current position = square root of [(x orig ) 2 + (v orig * T) 2 ] = sqrt(2) 4. Propagation of variables
46
5. Math46 Multiple dimensions rWhen multiple dimensions are included, covariance matrices can be added rWhen an error source goes through a linear transformation, resulting covariance is expressed as follows P 1 = covariance of error source 1 P 2 = covariance of error source 2 P = resulting covariance = P 1 + P 2 T = linear transformation T T = transform of linear transformation P orig = covariance of original error source P = T * P * T T 4. Propagation of variables
47
5. Math47 Example -- propagation of position x orig = standard deviation in original position = 2 m v orig = standard deviation in original velocity = 0.5 m/s T = time between samples = 4 sec x current = error in current position x current = x orig + T * v orig v current = v orig 1 4 0 1 T =P orig = 2 0 0 0.5 2 P current = T * P orig * T T = 1 4 0 1 1 0 4 1 4 0 0 0.25 = 16 4 4 0.25 4. Propagation of variables
48
5. Math48 Example -- angular rotation 5. Statistics X original = original coordinates X current = current coordinates T = transformation corresponding to angular rotation cos -sin sin cos T = where = atan(0.75) P orig = 1.64 -0.48 -0.48 1.36 P current = T * P orig * T T = 0.8 -0.6 0.6 0.8 = 2 0 0 1 1.64 -0.48 -0.48 1.36 0.8 0.6 -0.6 0.8 x’ y’ x y
49
5. Math49 5. Geometry rUnit vectors rAngle between two lines rPerpendicular to a plane rPointing 5. Geometry
50
5. Math50 Unit vectors rA unit vector is a vector of length 1. rUnit vectors are frequently used to denote vectors that have the same direction, such as those parallel to a chosen axis of a coordinate system 5. Geometry
51
5. Math51 Angle between two lines (1 of 10) rThe dot product is the result of multiplying the length of a vector A times the length of the component of vector B that is parallel to A rA B = |A| |B| cos , where is the angle between the vectors Dot product 5. Geometry
52
5. Math52 Angle between two lines (2 of 10) rTo find the angle between two lines, Establish a vector A and a vector B along each line Solve for = arccos[A B /( |A| |B| )] 0 Solving for using dot product 5. Geometry
53
5. Math53 Angle between two lines (3 of 10) rA = [1 2], B = [2 1] r|A| = SQRT(1 2 + 2 2 ) = SQRT(5) r|B| = SQRT(2 2 + 1 2 ) = SQRT(5) rA B = [1 2] [2 1] T = [2 1 + 2 1] = 4 r4 = SQRT(5) SQRT(5) cos rcos = 4/5 A B x y Example using dot product 5. Geometry
54
5. Math54 Angle between two lines (4 of 10) Using Excel to compute values 5. Geometry
55
5. Math55 Angle between two lines (5 of 10) rThe cross product is the result of multiplying the length of a vector A times the length of the component of vector B that is perpendicular to A rA x B = |A| |B|sin , where is the angle between the vectors rThe vector A x B is perpendicular to the plane containing A and B Cross product 5. Geometry
56
5. Math56 Angle between two lines (6 of 10) rTo find the angle between two lines, Establish a vector A and a vector B along each line Solve for = arcsin[A x B /( |A| |B| )] - /2 /2 Solving for using cross product 5. Geometry
57
5. Math57 Angle between two lines (7 of 10) A = i j k Ax Ay Az Bx By Bz = i j k 1 2 0 2 1 0 = -3k Example using cross product 5. Geometry
58
5. Math58 Angle between two lines (8 of 10) rA = [1 2], B = [2 1] r|A| = SQRT(1 2 + 2 2 ) = SQRT(5) r|B| = SQRT(2 2 + 1 2 ) = SQRT(5) rA x B = -3 k r-3 = SQRT(5) SQRT(5) sin rsin = -3/5 Example using cross product (continued) 5. Geometry
59
5. Math59 Angle between two lines (9 of 10) r = atan2(sin , cos ) Combining dot product and cross product 5. Geometry
60
5. Math60 Angle between two lines (10 of 10) Using Excel to compute arctangents 5. Geometry
61
5. Math61 Perpendicular to a plane rThe cross product defines the direction perpendicular to the plane defined by the two vectors A and B 5. Geometry
62
5. Math62 Pointing (1 of 14) A (3,1,1) B (2,3,2) camera x0 y0 r Change pointing of camera so that points A and B are on the same level Point camera as directed 5. Geometry
63
5. Math63 Pointing (2 of 14) A (3,1,1) B (2,3,2) x0 y0 camera x1 y1 z0 and z1 are positive out of page Pan camera to point at A in the x0-y0 plane 5. Geometry
64
5. Math64 Pointing (3 of 14) = atan2(3,1) = 18.4 o cos sin 0 -sin cos 0 0 0 1 311311 = 3.16 0.00 1.00 cos sin 0 -sin cos 0 0 0 1 232232 = 2.85 2.22 2.00 T01 Determine T01 as follows 5. Geometry
65
5. Math65 Pointing (4 of 14) A (3.16,0,1) B (2.85,2.22,2) x1 y1 camera z1 is positive out of page Redraw problem in x1-y1 5. Geometry
66
5. Math66 Pointing (5 of 14) A (3.16,0,1) B (2.85,2.22,2) x1 z1 camera y1 is positive into page View x1-z1 plane 5. Geometry
67
5. Math67 Pointing (6 of 14) A (3.16,0,1) B (2.85,2.22,2) x1 z1 camera x2 z2 y1 and y2 are positive into page Elevate camera to point at A in x1-z1 plane 5. Geometry
68
5. Math68 Pointing (7 of 14) = atan2(1,3.16) = 17.5 o cos 0 sin 0 1 0 -sin 0 cos = 3.16 0.00 = 2.85 2.22 2.00 3.16 0.00 1.00 cos 0 sin 0 1 0 -sin 0 cos 3.32 2.21 1.05 T12 Determine T12 as follows 5. Geometry
69
5. Math69 Pointing (8 of 14) A (3.16,0,0) B (3.32,2.21,1.05) z2 x2 is positive into page y2 View y2-z2 plane 5. Geometry
70
5. Math70 Pointing (9 of 14) A (3.16,0,0) B (3.32,2.21,1.05) z2 x2 and x3 are positive into page y2 z3 y3 Roll camera so that A and B are on horizontal line 5. Geometry
71
5. Math71 Pointing (10 of 14) = atan2(1.05.2.21) = 25.4 o = 1 0 0 0 cos sin 0 -sin cos 3.32 2.45 0.00 3.32 2.21 1.05 T23 Determine T23 as follows 5. Geometry
72
5. Math72 Pointing (11 of 14) A (3.16,0,0) B (3.32,2.45,0) z3 x3 is positive into page y3 View y3-z3 plane 5. Geometry
73
5. Math73 Pointing (12 of 14) T01 T T12 T T23 T 001001 -0.12 -0.49 0.86 = Express unit vector perpendicular to AB in x0-y0-z0 plane 5. Geometry
74
5. Math74 Pointing (13 of 14) A = i j k Ax Ay Az Bx By Bz = i j k 3 1 1 2 3 2 = (- i - 4j +7k)/sqrt(66) -0.12 -0.49 0.86 = Compare perpendicular unit vector to cross product 5. Geometry
75
5. Math75 Pointing (14 of 14) rT01, T12, T23, and any of their products are examples of direction cosine matrices rThe element in a ij is the cosine between axis i and axis j Define direction cosine matrix 5. Geometry
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.