1 / 75

Agenda

Agenda. 1. Tools 2. Matrices 3. Least squares 4. Propagation of variances 5. Geometry. 1. Tools. Excel Matlab Mathcad Labview. 1. Tools. Excel. Spreadsheet Readily available Solver functions. 1. Tools. Matlab. Matrix based Powerful analytical tool Handles transforms well

Download Presentation

Agenda

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Agenda 1. Tools 2. Matrices 3. Least squares 4. Propagation of variances 5. Geometry

  2. 1. Tools Excel Matlab Mathcad Labview 1. Tools

  3. Excel • Spreadsheet • Readily available • Solver functions 1. Tools

  4. Matlab • Matrix based • Powerful analytical tool • Handles transforms well • Easy to program 1. Tools

  5. Mathcad • Mathematical tool • Evolving into handling transfer functions • Has special programming language • Documentation closer to real math 1. Tools

  6. Labview • Powerful analysis tool • Uses graphical language to translate concepts into C-code and then execute 1. Tools

  7. 2. Matrices (1 of 2) • Addition • Subtraction • Multiplication • Vector, dot product, & outer product • Transpose • Determinant of a 2x2 matrix • Cofactor and adjoint matrices • Determinant • Inverse matrix 2. Matrices

  8. Matrices (2 of 2) • Orthogonal matrix • Hermetian matrix • Unitary matrix 2. Matrices

  9. Addition (1 of 2) C=A+B 1 -1 -1 0 4 2 -1 0 1 2 -2 -1 -2 5 -1 1 0 3 1 -1 0 -2 1 -3 2 0 2 A= B= C= cIJ = aIJ + bIJ 2. Matrices

  10. Addition (2 of 2) Matrix addition using Excel 2. Matrices

  11. Subtraction (1 of 2) C=A-B 1 -1 -1 0 4 2 -1 0 1 0 0 1 -2 -3 -5 3 0 1 1 -1 0 -2 1 -3 2 0 2 A= B= C= cIJ = aIJ - bIJ 2. Matrices

  12. Subtraction (2 of 2) Matrix subtraction using Excel 2. Matrices

  13. Multiplication (1 of 2) C=A*B 1 -1 -1 0 4 2 -1 0 1 1 -5 -3 1 6 1 0 -2 0 1 -1 0 -2 1 -3 2 0 2 A= B= C= cIJ = aI1 * b1J + aI2 * b2J + aI3 * b3J 2. Matrices

  14. Multiplication (2 of 2) Matrix multiplication using Excel 2. Matrices

  15. Transpose (1 of 3) B=AT 1 -1 0 -2 1 -3 2 0 2 1 -2 2 -1 1 0 0 -3 2 A= B= bIJ = aJI 2. Matrices

  16. Transpose (2 of 3) Matrix transpose using Excel 2. Matrices

  17. Transpose (3 of 3) • (AB)T = BT AT 1 -1 0 -2 1 -3 2 0 2 1 -1 -1 0 4 2 -1 0 1 1 1 0 -5 6 -2 -3 1 0 A= B= (AB)T = 1 0 -1 -1 4 0 -1 2 1 1 -2 2 -1 1 0 0 -3 2 1 1 0 -5 6 -2 -3 1 0 AT = BT = BTAT = 2. Matrices

  18. Vector, dot & outer products (1 of 2) • A vector v is an N x 1 matrix • Dot product = inner product = vT x v = a scalar • Outer product = v x vT = N x N matrix 2. Matrices

  19. Vector, dot & outer products (2 of 2) Matrix inner and outer products using Excel 2. Matrices

  20. Determinant of a 2x2 matrix 1 -1 -2 1 B = = -1 2x2 determinant = b11 * b22 - bI2 * b21 2. Matrices

  21. Cofactor and adjoint matrices 1 -1 0 -2 1 -3 2 0 2 A= 1 -3 0 2 -2 -3 2 2 -2 1 2 0 - 2 -2 -2 2 2 -2 3 3 -1 -1 0 0 2 1 0 2 2 1 -1 2 0 B = cofactor = - = - -1 0 0 -3 1 0 -2 -3 1 -1 -2 1 - 2 2 3 -2 2 3 -2 -2 -1 C=BT = adjoint= 2. Matrices

  22. Determinant 1 -1 0 -2 1 -3 2 0 2 determinant of A = =4 1 -1 0 2 -2 -2 = 4 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 2. Matrices

  23. Inverse matrix (1 of 3) 0.5 0.5 0.75 -0.5 0.5 0.75 -0.5 -0.5 -0.25 B = A-1 =adjoint(A)/determinant(A) = 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 = Inverse 2. Matrices

  24. Inverse matrix (2 of 3) Matrix inverse using Excel 2. Matrices

  25. Inverse matrix (3 of 3) 1 -1 0 -2 1 -3 2 0 2 1 -1 -1 0 4 2 -1 0 1 0.25 0.75 1.625 0 0 -0.5 -0.25 0.35 1.375 • (AB)-1 = B-1 A-1 A= B= (AB)-1 = 0.5 0.5 0.75 -0.5 0.5 0.75 -0.5 -0.5 -0.25 A-1 = 0.25 0.75 1.625 0 0 -0.5 -0.25 0.35 1.375 B-1A-1 = 2 0.5 1 -1 0 -1 2 0.5 2 B-1 = Inverse of a product 2. Matrices

  26. Orthogonal matrix • An 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. Hermetian matrix (1 of 3) • A Hermetian matrix is a matrix that is equal to its own Hermetian transpose • A = AH • The Hermetian transpose of A is the complex conjugate transpose of A • AH = AT Hermetian matrix 2. Matrices

  28. 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 AT = 1 1-I 2 1+I 3 i 2 -i 0 AT = = A Example 2. Matrices

  29. Hermetian matrix (3 of 3) Hermetian matrix using Excel 2. Matrices

  30. Unitary matrix • A matrix is unitary if its inverse equals its Hermetian transpose • U-1 = UH • DFT and inverse DFT are unitary matrices 2. Matrices

  31. 3. Least squares • Example 1 • Example 2 3. Least squares

  32. Example 1 (1 of 9) x + 2y + 3z = 14 -2x + + z = 1 2x + y = 4 1 2 3 -2 0 1 2 1 0 -1 3 2 2 -6 -7 -2 3 4 14 1 4 -1/3 A = A-1 = b = x y z 1 2 3 = A-1 b = Solve 3 equations and 3 unknowns 3. Least squares

  33. Example 1 (2 of 9) x + 2y + 3z = 14 -2x + + z = 1 2x + y = 4 3x + y - z = 2 x y z 1 2 3 = x + 2y + 3z = 13 -2x + + z = 1 2x + y = 4 3x + y - z = 3 x y z = ? What happens if we have 4 equations and 3 unknowns 3. Least squares

  34. Example 1 (3 of 9) e1 = x + 2y + 3z - 13 e2 = -2x + + z - 1 e3 = 2x + y - 4 e4 = 3x + y - z - 3 Minimize J = (e12 + e22 +e32 +e42) Minimize the sum of squares 3. Least squares

  35. Example 1 (4 of 9) Solve using Solver in Excel 3. Least squares

  36. Example 1 (5 of 9) e1 = x + 2y + 3z - 13 e2 = -2x + + z - 1 e3 = 2x + y - 4 e4 = 3x + y - z - 3 1 2 3 -2 0 1 2 1 0 3 1 1 13 1 4 3 b = A = x y z 0.46 3.37 1.91 ATA s = AT b s = [ATA]-1 AT b = = Solve using matrices 3. Least squares

  37. Example 1 (6 of 9) a1x a1y a1z a2x a2y a2z a3x a3y a3z a4x a4y a4z b1 b2 b3 b4 a1x a2x a3x a4x a1y a2y a3y a4y a1z a2z a3z a4z A = AT = b = a1x a2x a3x a4x a1y a2y a3y a4y a1z a2z a3z a4z a1x a1y a1z a2x a2y a2z a3x a3y a3z a4x a4y a4z AT A =  akx akx  aky akx  akz akx  akx aky  aky aky  akz aky  akx akz  aky akz  akz akz = Express matrix solution in more general terms 3. Least squares

  38. Example 1 (7 of 9)  akxbk  akxbk  akzbk AT b = Express matrix solution in more general terms (cont) 3. Least squares

  39. Example 1 (8 of 9) J = [a1xx + a1yy + a1zz - b1]2 + [a2xx + a2yy + a2zz - b2]2 + [a3xx + a3yy + a3zz - b3]2 + [a4xx + a4yy + a4zz - b4]2 J/ x = 2[a1xa1xx + a1ya1xy + a1za1xz - a1xb1] + [a2xa2xx + a2ya2xy + a2za2xz - a2xb2] + [a3xa3xx + a3ya3xy + a3za3xz - a3xb3] + [a4xa4xx + a4ya4xy + a4za4xz - a4xb4] 2[ akx akx x aky akx y akz akxz -  akxbk ] = 0 Minimize by calculus 3. Least squares

  40. Example 1 (9 of 9)  akx akx x aky akx y akz akxz -  akxbk = 0  akx aky x aky aky y akz akyz -  akybk = 0  akx akz x aky akz y akz akzz -  akzbz = 0  akx akx  aky akx  akz akx  akx aky  aky aky  akz aky  akx akz  aky akz  akz akz  akxbk  akybk  akzbk x y z - = 0 Minimize by calculus (continued) 3. Least squares

  41. Example 2 (1 of 3) 1.1000 1.9000 2.9000 4.0000 5.0000 6.0000 2.2000 3.0000 4.1000 5.0000 6.1000 6.9000 x = y = Fit a curve to the following data 3. Least squares

  42. Example 2 (2 of 3) Fit z = a + b xi + c xi2 A = [[1;1;1;1;1;1], x, x.*x] = 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 b = y a b c 1.0126 1.0949 -0.0184 = (ATA)-1 AT b = Fit curve z to data 3. Least squares

  43. Example 2 (3 of 3) error = a + b x + c x2 - y = -0.0052 0.0266 -0.0668 0.0980 -0.0726 0.0200 Error in curve fit 3. Least squares

  44. 4. Propagation of variance • Combining variance • Multiple dimensions • Example -- propagation of position • Example -- angular rotation 4. Propagation of variables

  45. Combining variances • Variances from multiple error sources can be combined by adding variances • Example xorig = standard deviation in original position = 1 m vorig = standard deviation in original velocity = 0.5 m/s T = time between samples = 2 sec xcurrent = error in current position = square root of [(xorig)2 + (vorig * T)2] = sqrt(2) 4. Propagation of variables

  46. Multiple dimensions • When multiple dimensions are included, covariance matrices can be added • When an error source goes through a linear transformation, resulting covariance is expressed as follows P1 = covariance of error source 1 P2 = covariance of error source 2 P = resulting covariance = P1 + P2 T = linear transformation TT = transpose of linear transformation Porig = covariance of original error source P = T * P * TT 4. Propagation of variables

  47. Example -- propagation of position xorig = standard deviation in original position = 2 m vorig = standard deviation in original velocity = 0.5 m/s T = time between samples = 4 sec xcurrent = error in current position xcurrent = xorig + T * vorig vcurrent = vorig 0 22 1 4 0 1 T = Porig = 0.52 0 1 4 0 1 0 1 0 4 1 4 4 8 = Pcurrent = T * P orig * TT = 0.25 0.25 0 4 4. Propagation of variables

  48. Example -- angular rotation Xoriginal = original coordinates Xcurrent = current coordinates T = transformation corresponding to angular rotation y y’ cos -sin  sin  cos  T = where  = atan(0.75) x’  x 1.64 -0.48 Porig = -0.48 1.36 0.8 -0.6 0.6 0.8 0.8 0.6 -0.6 0.8 0 1.64 -0.48 2 = Pcurrent = T * P orig * TT = 1 -0.48 1.36 0 5. Statistics

  49. 5. Geometry • Unit vectors • Angle between two lines • Perpendicular to a plane • Pointing 5. Geometry

  50. Unit vectors • A unit vector is a vector of length 1. • Unit 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

More Related