I've been given the following problem to solve, and I'm having a lot of difficulty in understanding what I can do.
The system $\dot x = x + u$, where $u = u(t)$ is not subject to any constraint, is to be controlled from $x(0) = 3$ to $x(t_1) = 2$, where $t_1$ is unspecified, such that $$J = \int_0^{t_1} (x^2 + ux + \frac{1}{2} u^2) dt$$ is minimised. Find the optimal control.
Basically, I've tried to follow my lecture notes as closely as possible, but I'm not sure whether I'm doing the right things.
To begin, I've set $f_0 = x^2 + ux + \frac{1}{2} u^2$, and $f_1 = x + u$. Then, I get the following Hamiltonian equation; $$H = -f_0 + \psi f_1 = -(x^2 + ux + \frac{1}{2} u^2) + \psi x + \psi u$$
Now, from my lecture notes, I know that $\frac{\partial H}{\partial u} = 0$, and $\dot \psi = \frac{- \partial H}{\partial x}$. This gives me two equations; $$\dot \psi = 2x + u - \psi$$ $$0 = -x - u + \psi$$
Now, here's where I might be making my mistakes. I added the two equations together, in order to cancel out terms; $$\dot \psi = x$$ Solving this equation, I get $\psi = \frac{1}{2} x^2 + A$.
However, at this point, I'm not too sure where I am supposed to go. Do I substitute this equation for $\psi$ into my previous equations, in order to solve for $u$??
Any assistance would be fantastic, even if it's just a link to a few examples. I'm rather lost in where to proceed with this question.
Okay, I think I've worked it out!!
First, we maximise $H$ by considering $\frac{\partial H}{\partial u} = 0$. Then, we have; $$0 = \frac{\partial H}{\partial U} = -x - u + \psi$$ $$\implies u = \psi - x$$
Now, we can also note that $\frac{\partial^2 H}{\partial u^2} = -1 < 0$, so $H$ is definitely maximised.
Then, we consider $\dot \psi = \frac{-\partial H}{\partial x}$; $$\dot \psi = \frac{-\partial H}{\partial x} = 2x + u - \psi$$.
Now, we recall that the optimal state equation is $\dot x = x + u$; $$\implies \dot x = x + (\psi - x)$$ $$\implies \dot x = \psi$$
Then, we have; $$\ddot x = \dot \psi = 2x + u - \psi = 2x + (\psi - x) - \psi = x$$ $$\implies x(t) = Ae^t + Be^{-t}$$ $$\therefore \psi = Ae^t - Be^{-t}$$ $$\therefore u = -2Be^{-t}$$
Now that we have equations for $u$, $x$, and $\psi$, we can substitute into $H$. I'd rather avoid writing all this out, so I'll just state that the result is $H = -2AB$. Now, I would like some input as to the justification here, but from lecture notes, we can basically use this result to see that $AB = 0$.
Taking $AB = 0$, we then have either $A = 0$ or $B = 0$.
If we take $B=0$, then we have that $x(t) = 3e^t$ (from our initial conditions). Then; $$x(t_1) = 2 = 3e^{t_1}$$ $$\implies t_1 = -\ln(\frac{3}{2}) < 0$$ So, $B$ cannot be zero.
If we take $A = 0$, then we have that $x(t) = 3e^{-t}$. Thus, we have $t_1 = \ln(\frac{3}{2}) > 0$, so we're satisfied our conditions!!
Then, we have that $u^*(t) = -6e^{-t}$ is the optimal control, with $x^*(t) = 3e^{-t}$. It then follows that $J = \frac{5}{2}$.
Apart from that jump of setting $AB = 0$, I'm fairly confident with this answer.