## 6 Parameter Estimation of 2-DOF Planar Arm
#### Trust Region Algorithm for Nonlinear Least Squares  
Nonlinear optimization is the minimization of a function according to the following formulation:  
\[\underset{x\in\Re^{n}}{\text{min}}f(x) \tag{11}\]  
subject to \(c_{i}(x)=0\) for \(i=1,2,\,\ldots\,m_{e}\) and \(c_{i}(x)\geq 0\) for \(i=m_{e}+1,\,\ldots\,m\). Functions \(f(x)\) and \(c_{i}(x)\) hold that they are real, defined in \(R^{n}\); at least one of them is nonlinear; for the coefficients \(m\) and \(m_{e}\), it holds that are nonnegative integers, and \(m\geq m_{e}\). It holds that, if \(m=m_{e}=0\), the function (Equation (11)) presents an unconstrained optimization problem. If this condition does not apply, then Equation (11) is a constrained optimization problem. Optimization problems are solved by numerical iteration methods, which means that the approximate solution of the function at the point \(x_{k}\) is in the k-th iteration. The new point (approach to the solution) \(x_{k+1}\) is determined computationally based on an algorithm. Such approximation to the solution is applied until the solution is acceptable. An important aspect in the direction of the search, whereby solving subtasks it is verified whether the points are approaching, resp. do not come close to the solution. One of the algorithms that can be applied is the Trust Region Algorithm [32; 33; 34; 35]. The Trust Region Algorithm for Nonlinear Least Squares is similar to the method Levenberg-Marquardt [25; 36] used to solve nonlinear functions. Although it is a newer algorithm (compared to Levenberg-Marquardt), it brings advantages such as robustness, reliability and convergence properties. In this algorithm, the model is said to be trusted if the area is close to the solution. Such an area is called a trust region and is modified at each subsequent iteration. This means that if in a certain iteration the approximate model is not good enough (it, therefore, contains a bad point), the area of confidence will not be increased but, on the contrary, will decrease. After a nonlinear optimization problem was defined using Equation (12), if this problem were unconstrained, the algorithm model could be constructed under the condition that the trial step in the k-th iteration would be determined as [34]:  
\[\underset{d\in R^{n}}{\text{min}}g_{k}^{T}d+\frac{1}{2}d^{T}b_{k}d =\varphi_{k}(d)\] (12) Subject to \[\left\|d\right\|_{2}\leq\Delta_{k} \tag{13}\]where \(b_{k}\) is a symmetric matrix of dimension \(n\!x\!n\) approaching the Hessian of the function \(f(x)\); \(g_{k}\) represents the gradient at the current iteration \(x_{k}\); \(\Delta_{k}\) is greater than zero and represents the trust-region radius. If Equation (13) is subtracted from Equation (12), then the difference is \(S_{k}\). Subsequently, if the difference \(\varphi_{k}(0)-\varphi_{k}(S_{k})\) is determined, the result is \(P_{k}\), which represents the predicted reduction. For \(P_{k}\), holds it is positive if \(x_{k}\) is a stationary point and \(b_{k}\) is a positive semi-definite. Actual reduction \(A_{k}\) (reduction in objective function) can be determined as Algorithm 1 [34]:  
\[A_{k}=f(x_{k})-f(x_{k}+S_{k}) \tag{14}\]  
If the ratio is the actual reduction \(A_{k}\) and the predicted reduction \(P_{k}\), it is obtained an important ratio \(r_{k}\), which firstly expresses whether the test step is acceptable and secondly determines the adaptation of the new trust-region radius.