Skip to content

Commit ecc1f9a

Browse files
authored
initial doc
1 parent 3f171aa commit ecc1f9a

File tree

1 file changed

+128
-0
lines changed

1 file changed

+128
-0
lines changed
+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"### Tying LQE and Adaptive filter "
8+
]
9+
},
10+
{
11+
"cell_type": "markdown",
12+
"metadata": {},
13+
"source": [
14+
"For a Linear system\n",
15+
"\\begin{align}\n",
16+
"\\dot x = Ax \\\\\n",
17+
"y = Cx\n",
18+
"\\end{align}\n",
19+
"\n",
20+
"Without adding the command, this can also be described by \n",
21+
"\\begin{align}\n",
22+
"x(t)= e^{At}.x(0)\n",
23+
"\\end{align}\n",
24+
"\n",
25+
"#### LQR control problem\n",
26+
"To drive this system states to zero, we add control to the system to push it to the negative real side by adding a control $u = -K_c.x$ (the control gain is the PD gain).\n",
27+
"\\begin{align}\n",
28+
"\\begin{split}\n",
29+
"\\dot x &= Ax + Bu \\\\ \\\\\n",
30+
"\\dot x &= (A - BK_c)x\n",
31+
"\\end{split}\n",
32+
"\\end{align}\n",
33+
"\n",
34+
"Now when the eigen values are negative, the exponential $e^{(A - BK_c)}$ can bring the state $x$ to zero from any arbitrary state $x_o$"
35+
]
36+
},
37+
{
38+
"cell_type": "markdown",
39+
"metadata": {},
40+
"source": [
41+
"#### LQE problem"
42+
]
43+
},
44+
{
45+
"cell_type": "markdown",
46+
"metadata": {},
47+
"source": [
48+
"From the observation $y$, we need to get a $\\hat{x}$, the estimation of the states. The dynamics of this estimate could be written as:\n",
49+
"\\begin{align}\\begin{split}\n",
50+
"\\dot{\\hat x} &= A \\hat{x} + Bu + K_f (y-\\hat{y}) \\\\ \\\\\n",
51+
"&= A \\hat{x} + Bu + K_f y- K_fC\\hat{x} \\\\ \\\\\n",
52+
"\\dot{\\hat x}&= (A - K_fC) \\hat{x} + \\begin{bmatrix} B & K_f \\end{bmatrix}\n",
53+
"\\begin{bmatrix} u \\\\ y \\end{bmatrix} \n",
54+
"\\end{split}\\end{align}"
55+
]
56+
},
57+
{
58+
"cell_type": "markdown",
59+
"metadata": {},
60+
"source": [
61+
"To observe the duality between the LQR and LQE system, let's rewrite the LQE problem into the error dynamics ($\\varepsilon =x - \\hat{x}$)\n",
62+
"\\begin{align}\n",
63+
"\\begin{split}\n",
64+
"\\dot \\varepsilon = \\dot x - \\dot{\\hat x} & = (Ax+Bu) - (A - K_fC) \\hat{x} + \\begin{bmatrix} B & K_f \\end{bmatrix}\\begin{bmatrix} u \\\\ y \\end{bmatrix} \\\\\n",
65+
"& = Ax - A \\hat{x} + Bu - Bu + K_f C \\hat{x} - K_fy\\\\\n",
66+
"\\dot \\varepsilon &= (A - K_fC)\\varepsilon\n",
67+
"\\end{split}\n",
68+
"\\end{align}"
69+
]
70+
},
71+
{
72+
"cell_type": "markdown",
73+
"metadata": {},
74+
"source": [
75+
"Comparing this with the LQR problem here we add some $-K_f\\varepsilon$ to the predicted state to converge the error to zero\n"
76+
]
77+
},
78+
{
79+
"cell_type": "markdown",
80+
"metadata": {},
81+
"source": [
82+
"#### Adaptive control from LQR\n",
83+
"For the adaptive control in \n",
84+
"\\begin{equation}\n",
85+
"s = \\dot e + \\lambda e \\\\\n",
86+
"\\end{equation}\n",
87+
"The non linear parameters specific to the model, example the pendulum\n",
88+
"\\begin{equation}\n",
89+
"Y = \\begin{bmatrix} \\ddot x_r & \\dot x & sin(x) \\end{bmatrix}\\\\\n",
90+
"\\end{equation}\n",
91+
"And the update of the parameters:\n",
92+
"\\begin{equation}\n",
93+
"\\dot {\\hat a} = - \\gamma Y^Ts \\\\\n",
94+
"u = Y\\hat a - ks\n",
95+
"\\end{equation}\n",
96+
"were the $-ks$ part resembles the PD control"
97+
]
98+
},
99+
{
100+
"cell_type": "code",
101+
"execution_count": null,
102+
"metadata": {},
103+
"outputs": [],
104+
"source": []
105+
}
106+
],
107+
"metadata": {
108+
"kernelspec": {
109+
"display_name": "Python 3",
110+
"language": "python",
111+
"name": "python3"
112+
},
113+
"language_info": {
114+
"codemirror_mode": {
115+
"name": "ipython",
116+
"version": 3
117+
},
118+
"file_extension": ".py",
119+
"mimetype": "text/x-python",
120+
"name": "python",
121+
"nbconvert_exporter": "python",
122+
"pygments_lexer": "ipython3",
123+
"version": "3.7.3"
124+
}
125+
},
126+
"nbformat": 4,
127+
"nbformat_minor": 2
128+
}

0 commit comments

Comments
 (0)