Find best-fit parabola to the given data

13.3k Views Asked by At

Find the parabola $At^2+Bt+C$ that best approximates the data set $t= -1,0,1,2,3$ and $b(t) = 5,2,1,2,5$.

Would I be using least squares such that $x = (A^TA)^{-1}A^Tb$? Thank you in advance.

4

There are 4 best solutions below

0
On

Hint: In your case

$A=\begin{pmatrix}{} n&\sum_{i=1}^5 t_i & \sum_{i=1}^5 t_i^2 \\ \sum_{i=1}^5 t_i & \sum_{i=1}^5 t_i^2 & \sum_{i=1}^5 t_i^3 \\ \sum_{i=1}^5 t_i^2 & \sum_{i=1}^5 t_i^3 & \sum_{i=1}^5 t_i^4\end{pmatrix}=\begin{pmatrix}{} 5 & 5 & 15 \\ 5 & 15 & 35 \\ 15 & 35 & 99 \end{pmatrix}$

0
On

The normal equations will solve the general case. In your specific case, the values of $b(t)$ are symmetric around $t=1$, so the parabola must be $A(t-1)^2+(C-1)$. Using the point at $t=1$ we can see that $C=2$, then a quick check shows $A=1$ and we have $b(t)=(t-1)^2+1$, which fits the points perfectly.

1
On

Elaborating on what @callculus said we can do

enter image description here

Which in your case looks like this

enter image description here

then just solve for A, B, and C.

You can check you answer by looking at your final equation.

0
On

Problem statement

Given a sequence of $m=5$ data points $\left\{ x_{k}, y_{k} \right\}_{k=1}^{m}$, and the trial function $$ y(x) = a_{0} + a_{1} x + a_{2} x^{2}. $$ The linear system is $$ \begin{align} \mathbf{A} a &= y\\ % \left[ \begin{array}{rrr} 1 & -1 & 1 \\ 1 & 0 & 0 \\ 1 & 1 & 1 \\ 1 & 2 & 4 \\ 1 & 3 & 9 \\ \end{array} \right] % \left[ \begin{array}{rrr} a_{0} \\ a_{1} \\ a_{2} \end{array} \right] % & = % \left[ \begin{array}{rrr} 5 \\ 2 \\ 1 \\ 2 \\ 5 \end{array} \right] % \end{align} $$

Solution via normal equations

The normal equations are $$ \begin{align} \mathbf{A}^{*} \mathbf{A} a & = \mathbf{A}^{*} y \\ % \left[ \begin{array}{rrr} 5 & 5 & 15 \\ 5 & 15 & 35 \\ 15 & 35 & 99 \\ \end{array} \right] % \left[ \begin{array}{rrr} a_{0} \\ a_{1} \\ a_{2} \end{array} \right] % &= % \left[ \begin{array}{rrr} 15 \\ 15 \\ 59 \end{array} \right] % \end{align} $$ The solution is $$ \begin{align} a_{LS} & = \left( \mathbf{A}^{*} \mathbf{A} \right)^{-1} \mathbf{A}^{*} y \\ % &= \frac{1}{70} \left[ \begin{array}{rrr} 26 & 3 & -5 \\ 3 & 27 & -10 \\ -5 & -10 & 5 \\ \end{array} \right] % \left[ \begin{array}{rrr} 15 \\ 15 \\ 59 \end{array} \right] \\ % &= % \left[ \begin{array}{rrr} 2 \\ -2 \\ 1 \end{array} \right], % \end{align} $$ $$ y(x) = 2 -2x + x^{2}. $$ This is an exact fit because $$ r^{2} = \left( \mathbf{A} a_{LS} - b \right)^{*} \left( \mathbf{A} a_{LS} - b \right) = 0. $$

The plot shows the solution against the data points.

Data and solution