Unable to find the nonlinear least squares

In summary, the equation you are trying to solve is AX= Y:\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
  • #1
soopo
225
0

Homework Statement


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?

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.
 
Last edited:
Physics news on Phys.org
  • #2
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]
 
  • #3
HallsofIvy said:
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.
 

Related to Unable to find the nonlinear least squares

1. What is nonlinear least squares?

Nonlinear least squares is a mathematical optimization technique used to find the best fit for a nonlinear model to a set of data points. It is commonly used in scientific and statistical analysis to estimate parameters of a nonlinear model.

2. How does nonlinear least squares differ from linear least squares?

Linear least squares is used for fitting linear models to data, while nonlinear least squares is used for fitting nonlinear models. In linear least squares, the parameters are estimated using the sum of squared residuals, while in nonlinear least squares, the parameters are estimated using an iterative process that minimizes the sum of squared residuals.

3. What is the main difficulty in finding the nonlinear least squares?

The main difficulty in finding the nonlinear least squares is that there is no closed-form solution for the parameters. This means that the parameters must be estimated using an iterative process, which can be computationally intensive and time-consuming.

4. How is the initial guess for the parameters determined in nonlinear least squares?

The initial guess for the parameters in nonlinear least squares can be determined using various methods, such as trial and error or by using linear regression techniques. The initial guess is then refined through the iterative process until the parameters converge to a minimum sum of squared residuals.

5. How do you know if the result of nonlinear least squares is reliable?

The reliability of the result of nonlinear least squares can be assessed by examining the convergence of the parameters and the goodness of fit of the model to the data. Additionally, sensitivity analysis can be performed to determine the impact of any outliers or influential data points on the estimated parameters.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
7
Views
735
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
1K
  • Precalculus Mathematics Homework Help
Replies
12
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
1K
  • Precalculus Mathematics Homework Help
Replies
5
Views
2K
  • Precalculus Mathematics Homework Help
Replies
5
Views
2K
  • Calculus and Beyond Homework Help
Replies
1
Views
1K
  • Linear and Abstract Algebra
Replies
5
Views
1K
  • Linear and Abstract Algebra
Replies
1
Views
1K
  • Precalculus Mathematics Homework Help
Replies
4
Views
3K
Back
Top