Thread Closed

Unable to find the nonlinear least squares

 
Share Thread Thread Tools
Apr4-09, 12:53 AM   #1
 

Unable to find the nonlinear least squares


1. The problem statement, all variables and given/known data
We have the following x, y values
x ||| y
1.0 -0.15
1.5 0.24
2.0 0.68
2.5 1.04
3.0 1.21
3.5 1.15
4.0 0.86
4.5 0.41
5.0 -0.08

How can you find the equation
[tex]y(x) = ax^2 + bx + c[/tex]
by least squares?

3. The attempt at a solution
I know how to calculate the equation for a line by solving
Ax = b
taking transposes of A at the both sides
[tex]A^TAx = A^Tb[/tex]
and then solving for x.

My second attempt
I made a 9 x 3 matrix for A where the first two columns are ones, 3 x 1 for x and 9 x 1 for b.
However, I get a singular matrix for
[tex]A^TA.[/tex]

Apparently, my method is not right.

I could make 3 equations such as
y(0), y(1) and y(2)
and solve for a, b and c.
However, I see that the method is not least squares and also rather inaccurate, since
not all points are considered.
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> King Richard III found in 'untidy lozenge-shaped grave'
>> Google Drive sports new view and scan enhancements
>> Researcher admits mistakes in stem cell study
Apr4-09, 05:54 AM   #2
 
Recognitions:
Gold Membership Gold Member
Science Advisor Science Advisor
Retired Staff Staff Emeritus
To find [itex]y= ax^2+ bx+ c[/itex] that gives the best fit, the equation you are trying to solve is AX= Y:
[tex]\begin{bmatrix}x_1^2 & x_1 & 1 \\ x_2^2 & x_2 & 1\\\cdot & \cdot & \cdot \\\cdot & \cdot & \cdot \\ \cdot & \cdot & \cdot \\ x_n^2 & x_n & 1\end{bmatrix}\begin{bmatrix} a \\ b \\ c\end{bmatrix}\begin{bmatrix}y_1 \\ y_2 \\\cdot \\\cdot\\\cdot \\ y_n\end{bmatrix}[/tex]
Multiplying by the transpose of A on both sides gives an equation with a 3 by 3 matrix you can solve:

[tex]\begin{bmatrix} \sum x_i^4 & \sum x_i^3 & \sum x_i^2 \\ \sum x_i^3 & \sum x_i^2 & \sum x_i \\ \sum x_i^2 & \sum x_i & n\end{bmatrix}\begin{bmatrix}a \\ b \\ c\end{bmatrix}= \begin{bmatrix} \sum x_i^2y_i \\ \sum x_iy_i \\ \sum y_i \end{bmatrix}[/tex]
Apr7-09, 08:58 AM   #3
 
Quote by HallsofIvy View Post
To find [itex]y= ax^2+ bx+ c[/itex] that gives the best fit, the equation you are trying to solve is AX= Y:
[tex]\begin{bmatrix}x_1^2 & x_1 & 1 \\ x_2^2 & x_2 & 1\\\cdot & \cdot & \cdot \\\cdot & \cdot & \cdot \\ \cdot & \cdot & \cdot \\ x_n^2 & x_n & 1\end{bmatrix}\begin{bmatrix} a \\ b \\ c\end{bmatrix}\begin{bmatrix}y_1 \\ y_2 \\\cdot \\\cdot\\\cdot \\ y_n\end{bmatrix}[/tex]
Let your columns to be A1, A2 and A3, respectively for the first, second and third columns.
Is it wrong to write the columns as A3, A2, A1?

I have always set the column with the lowest degree to be the first column, and
so on.
Thread Closed

Tags
matrix least-squares
Thread Tools


Similar Threads for: Unable to find the nonlinear least squares
Thread Forum Replies
Nonlinear least squares problem General Engineering 0
fundamental question unable to find answer Introductory Physics Homework 4
Numerical Methods - Linear Least Squares, Non-Linear Least Squares, Optimization Calculus & Beyond Learning Materials 0
numerical solutions of system of nonlinear algebraic equations nonlinear algebraic eq General Math 6
z scan technic to find nonlinear coefficient General Physics 0