|
"AJ Smith" <ajsmith_15@hotmail.com> wrote in message <glst9p$dql$1@fred.mathworks.com>...
> I'm working on solving a system of non-linear equations in MATLAB. Currently I am able to solve a system of 3 equations with 3 unknowns using Newton's method (with a jacobian, etc). What I want to do is take 4 or more equations (still with 3 unknowns) and solve them, but when I do, the jacobian is non-square, therefore not invertable (also not compatible with the backslash operation). Does anybody have any ideas on how to go about soving this? Here are my equations, 'i' going from 1 to the number of equations I want. The knowns are a,b,and theta and the unknowns are x, y, and phi.
>
> 0 = a(i) - x - (b(i) - y)*tan(theta(i) + phi)
>
> Thanks!
>
> AJ
With four or more equations and three unknowns, you will probably have to use some kind of least squares method, because you are unlikely to find an exact solution. It might be better to find the least sum of squares of the four quantities in this form:
(a(i)-x)*cos(theta(i)+phi) + (b(i)-y)*sin(theta(i)+phi)
You will note that these are linear in x and y. For any given phi, it is possible to find the least sum of those squares using the backslash operator, thereby eliminating x and y from the problem. If you write a function to do this, you could use the value of that least squares sum as an objective function to be minimized with phi as your single value to be varied. For the optimization functions, one unknown is generally better than three.
Roger Stafford
|