| RcdMathLib_doc
    Open Source Library  for Linear and Non-linear Algebra | 
Examples of optimization algorithms. More...
#include <stdio.h>#include <math.h>#include "matrix.h"#include "vector.h"#include "levenberg_marquardt.h"#include "modified_gauss_newton.h"Go to the source code of this file.
| Functions | |
| void | optimization_get_J (vector_t x0_vec[], matrix_t J[][3]) | 
| Calculate the Jacobian matrix of the function optimization_get_f_error.  More... | |
| void | optimization_get_f_error (vector_t x0_vec[], vector_t measured_data_vec[], vector_t f_vec[]) | 
| Calculate the error vector of the approximation.  More... | |
| void | optimization_test (void) | 
| Examples of optimization algorithms using the LVM and GN algorithms. | |
| void | optimization_get_exp_f (vector_t x_vec[], vector_t data_vec[], vector_t f_vec[]) | 
| Calculate the error vector using exponential data.  More... | |
| void | optimization_get_exp_Jacobian (vector_t x_vec[], matrix_t J[][2]) | 
| Calculate the Jacobian matrix using exponential data.  More... | |
| void | optimization_exponential_data_test (void) | 
| Examples of optimization algorithms using exponential data.  More... | |
| void | optimization_get_sin_f (vector_t x_vec[], vector_t data_vec[], vector_t f_vec[]) | 
| Calculate the error vector using sinusoidal data.  More... | |
| void | optimization_get_sin_Jacobian (vector_t x_vec[], matrix_t J[][4]) | 
| Calculate the Jacobian matrix using sinusoidal data.  More... | |
| void | optimization_sinusoidal_data_test (void) | 
| Examples of optimization algorithms using sinusoidal data.  More... | |
Examples of optimization algorithms.
Optimization algorithms examples (see the modified GN and LVM optimization methods).
Definition in file optimization_test.c.
| void optimization_exponential_data_test | ( | void | ) | 
Examples of optimization algorithms using exponential data.
The model function is:  where
 where ![$\vec{x} = [x_1, x_2]^T$](form_5.png) and
 and ![$ \vec{x_0} = [6,.3]$](form_6.png) is the initial guess. The data set is
 is the initial guess. The data set is  , whereby
, whereby  is equal to
 is equal to  and
 and  is equal to
 is equal to  .
. 
Definition at line 264 of file optimization_test.c.
References matrix_t, modified_gauss_newton(), opt_levenberg_marquardt(), optimization_get_exp_f(), optimization_get_exp_Jacobian(), vector_clear(), and vector_t.
Calculate the error vector using exponential data.
The error function is: 
| [in] | x_vec[] | start vector. | 
| [in] | data_vec[] | data vector. | 
| [out] | f_vec[] | calculated error vector. | 
Definition at line 215 of file optimization_test.c.
References vector_t.
Referenced by optimization_exponential_data_test().
Calculate the Jacobian matrix using exponential data.
The Jacobian matrix is: 
| [in] | x_vec[] | start vector. | 
| [in] | J[] | Jacobian matrix. | 
Definition at line 251 of file optimization_test.c.
References vector_t.
Referenced by optimization_exponential_data_test().
Calculate the error vector of the approximation.
| [in] | x0_vec[] | start values. | 
| [in] | measured_data_vec[] | measured data vector. | 
| [out] | f_vec[] | calculated error vector. | 
Definition at line 70 of file optimization_test.c.
References matrix_t.
Referenced by optimization_test().
Calculate the Jacobian matrix of the function optimization_get_f_error.
| [in] | x0_vec[] | start values. | 
| [out] | J[][] | calculated Jacobian matrix. | 
Definition at line 39 of file optimization_test.c.
References matrix_t.
Referenced by optimization_test().
Calculate the error vector using sinusoidal data.
The error function is: 
| [in] | x_vec[] | start vector. | 
| [in] | data_vec[] | data vector. | 
| [out] | f_vec[] | calculated error vector. | 
Definition at line 325 of file optimization_test.c.
References vector_t.
Referenced by optimization_sinusoidal_data_test().
Calculate the Jacobian matrix using sinusoidal data.
The Jacobian matrix is ![$ J_f = \left[\begin{matrix} \sin\left( x_2 +x_3\right) & x_1 \cos\left( x_2 +x_3\right) & x_1\cos\left( x_2 +x_3\right) \\ \sin\left( 2 x_2 +x_3\right) & 2 x_1 \cos\left( 2 x_2 +x_3\right) & x_1 \cos\left( 2 x_2 +x_3\right)\\ \vdots & \vdots \\ \sin\left( 12 x_2 +x_3\right) & 12 x_1 \cos\left( 12 x_2 +x_3\right) & x_1 \cos\left( 12 x_2 +x_3\right) \end{matrix}\right]. $](form_3.png)
| [in] | x_vec[] | start vector. | 
| [in] | J[] | Jacobian matrix. | 
Definition at line 360 of file optimization_test.c.
References vector_t.
Referenced by optimization_sinusoidal_data_test().
| void optimization_sinusoidal_data_test | ( | void | ) | 
Examples of optimization algorithms using sinusoidal data.
The model function is:  whereby
 whereby ![$\vec{x} = [x_1, x_2, x_3, x_4]^T$](form_13.png) and
 and ![$\vec{x_0} = [17, 0.5, 10.5, 77]$](form_14.png) is the initial guess. The set of data points is
 is the initial guess. The set of data points is  , where
, where  is equal to
 is equal to  and
 and  is equal to
 is equal to  .
. 
Definition at line 376 of file optimization_test.c.
References matrix_t, modified_gauss_newton(), opt_levenberg_marquardt(), optimization_get_sin_f(), optimization_get_sin_Jacobian(), vector_clear(), and vector_t.