Download feature - EE Times
Transcript
programmer’s toolbox Equation 18 into C++ code is as simple as writing: Then I can write the problem in the incredibly compact form: x = u/A; Ax=u (17) An important point may have slipped past you. As we solved the example problem, it was not at all obvious that the input or constraint vector, u, is practically immaterial to the solution. The matrix A is purely a matrix of the coefficients of the elements of x—in our case, J, x=A-1u (18) M, and S. Therefore we can invert the matrix as a standalone entity, completely independently of u. In my statement of the problem, I could have substituted any conHow does one compute the inverse of a matrix? stant values whatever We’ve already done for the elements of u. it. The steps we took Many other problems look a lot easier While the resulting valin Equations 9 through 13 are nothusing matrix algebra, and many others are ues for x would absolutely be different, ing less than the the same problem, in disguise. the inverse of the maGaussian eliminatrix itself would be extion leading to the actly the same. This inverse. This one fact gives us a lot of leverage if we’re looking at different time, we did it the hard way, only one step removed values of u at different times. No matter how many such from the high school way. If you never liked those word values there are, we only need to invert A once. problems that ended up as simultaneous linear equations, rejoice: this is the last time you’ll ever have to do OTHER MATRIX APPLICATIONS it. Armed with a matrix inverse operator—all the comSolving word problems is certainly not at all the only mercial math aids have them, as will our C++ library— problems we can cast into matrix form. Many other you can go from Equation 17 to 18 in a single step. problems look a lot easier using matrix algebra, and Hooray! As a teaser, I’ll just toss out there that, while the ma- many others are the same problem, in disguise. A familiar one is linear regression, which in turn is a subset of trix division operator doesn’t exist, I’ve appropriated polynomial regression, which is itself a subset of optimal the division operator in the C++ class. Thus, turning There is no such thing as a division operator for matrices, but there is the next best thing: an inverse operator. So, conceptually, I can write: A least-squares fit. y A decent fit A better fit x Figure 1 16 DECEMBER 2007 | embedded systems design | www.embedded.com