Least Squares Solution's Example

Let's seek 2 coefficients' solution of a function(1) as the curve fitting by Least squares solution.

\(\large{y=ax^2e^{-bx}} \qquad (1)\)

Making Data Series

\(\large{a=} \)
\(\large{b=} \)
\(\large{ƒÐ=} \)

Data Range Setup

\(\large{y_i>} \)
\(\large{ƒÐ} \)

Execute Least Squares Solution

\(\large{a=} \)
\(\large{b=} \)

Explanation

This program takes the logarithm of (1), then it becomes (2).

\(\large{\log y = \log a + 2\log x - bx}\)
\(\large{c - xb= \log y - 2\log x} \qquad \left(c=\log a \right) \qquad (2)\)

To make Least squares solution, put it as (3). After solving \(\left(c, b\right)\), it can be as \(c \Rightarrow a\).

\(\large{ A^\mathsf{T}A \begin{bmatrix} c \\ b \end{bmatrix} = A^\mathsf{T}V } \qquad (3) \)
\(\large{ A= \begin{bmatrix} 1 & -x_1 \\ 1 & -x_2 \\ \vdots & \vdots \\ 1 & -x_n \end{bmatrix} }\) \(\large{ V= \begin{bmatrix} \log y_1 - 2\log x_1 \\ \log y_2 - 2\log x_2 \\ \vdots \\ \log y_n - 2\log x_n \\ \end{bmatrix} }\)

For taking the logarithm, the argument can not be a minus number below 0. Limit the data range
\(x_1 \Leftrightarrow x_n\) to satisfy (4).

\(\large{y_i > tƒÐ \qquad \left(0<= t <= 3 \right) \qquad (4)}\)

For the noisy signal, the curve fitting will be realized by disposing data around 0(zero). In practical,
this is enough in some cases. In addition, as executing Newton's method by giving the above gotton solutions
as the initial values, high-precision solutions which contain all data will be realized.