The Gauss-Newton method is a nonlinear least squares algorithm. The process involves making a series of guesses as to the value of x, then linearising an equation, say r, near the guesses. The result leads to a new guess, which is a linear least squares solution. The algorithm is repeated until convergence occurs. Performing this method by hand can be arduous process; the use of software such as MathWorks Matlab can perform complicated calculations in a much shorter amount of time.
- Skill level:
Other People Are Reading
Things you need
- Computer that runs Matlab by MathWorks
- Two nonlinear equations
- Region of estimated convergence
Rewrite your equations in the form F(X)=0. When typing the equations into Matlab, don't include the "=0" portion, only the expression to the left of the equals sign.
In a new .m file, type the lines "function F=myfun(x)" and "F=[(your first equation);(your second equation)];" without quotation marks. Save this function as "myfun.m" within your Matlab path.
On the editor screen, type "x0=[min;max];" where min and max are the minimum and maximum x values of your region of estimated convergence. On the next line, type "options=optimset('Display','iter');" to see the output from the iterations. All commands should be entered without double quotation marks, but single quote marks within the body of the command should remain.
To run the algorithm, type "[x,fval] = fsolve(@myfun,x0,LargeScale,'off', NonlEqnAlgorithm, 'gn')" without quotation marks and press enter. The command options for LargeScale and NonlEqnAlgorithm specifiy the procedure for Gauss Newton Method. The answer will display on the screen.
Tips and warnings
- Add semicolons to the end of lines if you do not want to see the output. Forgetting semicolons and displaying output could clog the editor screen.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for