https://github.com/krproject-tech/parameter_estimation_demo_by_ukf
Parameter estimation Demo by UKF
https://github.com/krproject-tech/parameter_estimation_demo_by_ukf
kalman-filter matlab parameter-estimation
Last synced: 30 days ago
JSON representation
Parameter estimation Demo by UKF
- Host: GitHub
- URL: https://github.com/krproject-tech/parameter_estimation_demo_by_ukf
- Owner: KRproject-tech
- License: mit
- Created: 2022-10-01T07:02:15.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-15T14:01:03.000Z (over 1 year ago)
- Last Synced: 2025-07-31T16:37:17.383Z (8 months ago)
- Topics: kalman-filter, matlab, parameter-estimation
- Language: MATLAB
- Homepage:
- Size: 479 KB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Parameter_estimation_demo_by_UKF


**Communication**
**Language**
Parameter estimation Demo by Unscented Kalman Filter (UKF) [^1][^2].
Example of dynamics is for the 1 DoF arm with spring, damping, and frictional forces at a joint.
Joint angle is measured, then, unknown damping and frictional coefficients are identified by UKF [^3][^4].
In spite of discontinuous model of frictional force, UKF can be applied dislike Extended Kalman Filter (EKF).
## Publications
This code was employed to estimate unknown parameters for the following publication(s):
* Optimal swimming locomotion of snake-like robot in viscous fluids, Journal of Fluids and Structures, Vol. 123 (2023).
https://doi.org/10.1016/j.jfluidstructs.2023.104007
````
@article{YAMANO2023104007,
title = {Optimal swimming locomotion of snake-like robot in viscous fluids},
journal = {Journal of Fluids and Structures},
volume = {123},
pages = {104007},
year = {2023},
issn = {0889-9746},
doi = {https://doi.org/10.1016/j.jfluidstructs.2023.104007},
author = {A. Yamano and T. Kimoto and Y. Inoue and M. Chiba}
}
````
* Fluid force identification acting on snake-like robots swimming in viscous fluids, Journal of Fluids and Structures, Vol. 106 (2021).
https://doi.org/10.1016/j.jfluidstructs.2021.103351
````
@article{YAMANO2021103351,
title = {Fluid force identification acting on snake-like robots swimming in viscous fluids},
journal = {Journal of Fluids and Structures},
volume = {106},
pages = {103351},
year = {2021},
issn = {0889-9746},
doi = {https://doi.org/10.1016/j.jfluidstructs.2021.103351},
author = {A. Yamano and K. Shimizu and M. Chiba and H. Ijima},
keywords = {Snake-like robot, Swimming motion, Highly viscous fluid, Unscented Kalman filter, Parameter estimation}
}
````
## Overview
Dynamics for the 1 DoF arm with spring, damping, and frictional forces at a joint is denoted as follows,
$$
J \ddot{\theta} + c \dot{\theta} + \mu {\rm sgn}{\dot{\theta}} + k \theta = u,
$$
where damping and friction coefficients; $c$ and $\mu$ are unknown variables.
From measured time series of data $y_m := \theta_m(t)$, these variables are identified by UKF.
Then, state space representation is denoted as,
$$
\begin{array}{c}
{\bf \dot{x}} = f( {\bf x}, {\bf u}), \\
y = {\bf C} {\bf x},
\end{array}
$$
where
$$
\begin{array}{c}
{\bf x} =
\left[
\begin{array}{c}
x_1 \\
x_2 \\
\end{array}
\right] :=
\left[
\begin{array}{c}
\theta \\
\dot{\theta} \\
\end{array}
\right], \\
f( {\bf x}, {\bf u}) :=
\left[
\begin{array}{c}
x_2 \\
-J^{-1} c x_2 - J^{-1} \mu {\rm sgn} x_2 - J^{-1}k x_1 \\
\end{array}
\right] + {\bf B} u, \\
\bf{B} :=
\left[
\begin{array}{c}
0 \\
J^{-1} \\
\end{array}
\right],
{\bf C} :=
\left[
\begin{array}{c}
1 \\
0 \\
\end{array}
\right]^T.
\end{array}
$$
Unknown damping and frictional coefficients are added to the expanded state vector as
$$
{\bf x_E} =
\left[
\begin{array}{c}
{\bf x} \\
x_3 \\
x_4 \\
\end{array}
\right] :=
\left[
\begin{array}{c}
{\bf x} \\
c \\
\mu \\
\end{array}
\right].
$$
Then, the expanded state representation is obtained as
$$
\begin{array}{c}
{\bf \dot{x}_E} = f_E( {\bf x_E}, {\bf u}), \\
y = {\bf C_E} {\bf x_E},
\end{array}
$$
where
$$
\begin{array}{c}
f_E( {\bf x_E}, {\bf u}) :=
\left[
\begin{array}{c}
x_2 \\
-J^{-1} c x_2 - J^{-1} \mu {\rm sgn} x_2 - J^{-1}k x_1 \\
0 \\
0 \\
\end{array}
\right] + {\bf B_E} u, \\
\bf{B}_E :=
\left[
\begin{array}{c}
0 \\
J^{-1} \\
0 \\
0 \\
\end{array}
\right],
{\bf C}_E :=
\left[
\begin{array}{c}
1 \\
0 \\
0 \\
0 \\
\end{array}
\right]^T.
\end{array}
$$
After that, the dynamics is discretized for time to apply UKF ("./functions/c2d_func.m" [3]).

## Usages
__[Step 1] Edit parameters__
Edit code in "param_setting.m".
Process model with the state-space representation ${\bf \dot{x}} = f( {\bf x}, {\bf u})$, observation model $y = {\bf C} {\bf x}$, and input $u(t)$ are defined in the "param_setting.m" as follows;
````python
%% system parameter
%%[0] continuous time system
J = 1;
k = 1;
f =@( x)[ x(2);
-1/J*x(3)*x(2) - 1/J*x(4)*sign( x(2)) - 1/J*k*x(1);
0;
0];
B = [ 0;
1/J;
0;
0];
bd = [ 1;
1;
0;
0];
C = [ 1 0 0 0];
ut = @( t)( 1.0);
````
__[Step 2] Start analysis__
Execute "demo.m".
## Images

Time series of state $x_1 := \theta (t)$.

Time series of output $y(t) := x_1(t)$

Identified damping and friction coefficients; $c$ and $\mu$, and deviations; $\sigma_c$ and $\sigma_\mu$, respectively.
### References
[^1]: Julier, S.J., Uhlmann, J.K., 2004. Unscented filtering and nonlinear estimation. Proc. IEEE 92 (3), 401–422.
[^2]: Julier, S.J., Uhlmann, J.K., Durrant-Whyte, H.F., 1995. A new approach for filtering nonlinear systems. In: Proceedings of 1995 American Control
Conference. ACC’95 3, pp. 1628–1632. http://dx.doi.org/10.1109/ACC.1995.529783.
[^3]: 足立 修一,丸田 一郎,「カルマンフィルタの基礎」,東京電機大学出版局.
[^4]: Fluid force identification acting on snake-like robots swimming in viscous fluids, Journal of Fluids and Structures, Vol. 106 (2021).
https://doi.org/10.1016/j.jfluidstructs.2021.103351