From c7da462379efbf5b1a5e115c94593f87c22ac1e4 Mon Sep 17 00:00:00 2001 From: Olivier Cots <66357348+ocots@users.noreply.github.com> Date: Thu, 5 Oct 2023 15:50:26 +0200 Subject: [PATCH] foo --- docs/src/tutorial-init.md | 4 ++++ docs/src/tutorial-lqr-basic.md | 2 +- docs/src/tutorial-plot.md | 19 +++++++++++-------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/docs/src/tutorial-init.md b/docs/src/tutorial-init.md index 10be52f7..00970acf 100644 --- a/docs/src/tutorial-init.md +++ b/docs/src/tutorial-init.md @@ -1,5 +1,9 @@ # Initial guess +```@meta +CurrentModule = OptimalControl +``` + We present in this tutorial the different possibilities to provide an initial guess to solve an optimal control problem using the [`solve`](@ref) command. For the illustrations, we define the following optimal control problem. ```@example main diff --git a/docs/src/tutorial-lqr-basic.md b/docs/src/tutorial-lqr-basic.md index ac00cc39..a24220e5 100644 --- a/docs/src/tutorial-lqr-basic.md +++ b/docs/src/tutorial-lqr-basic.md @@ -143,6 +143,6 @@ pu = plot(plt[5], legend=false, xlabel="s", ylabel="u") plot(px1, px2, pu, layout=(1, 3), size=(800, 300), leftmargin=5mm, bottommargin=5mm) ``` -!!! note +!!! note "Nota bene" We can observe that $x(t_f)$ converges to the origin as $t_f$ increases. diff --git a/docs/src/tutorial-plot.md b/docs/src/tutorial-plot.md index 4b7db6a2..cea7d498 100644 --- a/docs/src/tutorial-plot.md +++ b/docs/src/tutorial-plot.md @@ -1,6 +1,6 @@ # Plot a solution -In this tutorial we explain the different ways to plot a solution from an optimal control problem. +In this tutorial we explain the different ways to plot a solution of an optimal control problem. Let us start by importing the necessary package. @@ -35,11 +35,11 @@ plot(sol) As you can see, it produces a grid of subplots. The left column contains the state trajectories, the right column the costate trajectories, and at the bottom we have the control trajectory. -Attributes from `Plots.jl` can be passed to the `plot` function: +Attributes from [`Plots.jl`](https://docs.juliaplots.org) can be passed to the `plot` function: -- In addition to `sol` you can pass attributes to the full `Plot`, see the [attribute plot documentation](https://docs.juliaplots.org/latest/generated/attributes_plot/) from `Plots.jl` for more details. For instance, you can specify the size of the figure. -- You can also pass attributes to the subplots, see the [attribute subplot documentation](https://docs.juliaplots.org/latest/generated/attributes_subplot/) from `Plots.jl` for more details. However, it will affect all the subplots. For instance, you can specify the location of the legend. -- In the same way, you can pass axis attributes to the subplots, see the [attribute axis documentation](https://docs.juliaplots.org/latest/generated/attributes_axis/) from `Plots.jl` for more details. It will also affect all the subplots. For instance, you can remove the grid. +- In addition to `sol` you can pass attributes to the full `Plot`, see the [attributes plot documentation](https://docs.juliaplots.org/latest/generated/attributes_plot/) from `Plots.jl` for more details. For instance, you can specify the size of the figure. +- You can also pass attributes to the subplots, see the [attributes subplot documentation](https://docs.juliaplots.org/latest/generated/attributes_subplot/) from `Plots.jl` for more details. However, it will affect all the subplots. For instance, you can specify the location of the legend. +- In the same way, you can pass axis attributes to the subplots, see the [attributes axis documentation](https://docs.juliaplots.org/latest/generated/attributes_axis/) from `Plots.jl` for more details. It will also affect all the subplots. For instance, you can remove the grid. ```@example main plot(sol, size=(700, 450), legend=:bottomright, grid=false) @@ -84,11 +84,12 @@ sol2 = solve(ocp, display=false) nothing # hide ``` -We first plot the solution of the first optimal control problem. Then, we plot the solution of the second optimal control problem on the same figure, but with dashed lines. +We first plot the solution of the first optimal control problem, then, we plot the solution of the second optimal control problem on the same figure, but with dashed lines. ```@example main # first plot plt = plot(sol, size=(700, 450)) + # second plot style = (linestyle=:dash, ) plot!(plt, sol2, state_style=style, costate_style=style, control_style=style) @@ -118,6 +119,8 @@ u = sol.control plot(t, norm∘u, label="‖u‖") ``` -!!! note +!!! note "Nota bene" - The `norm` function is from `LinearAlgebra.jl`. The `∘` operator is the composition operator. Hence, `norm∘u` is equivalent to `t -> norm(u(t))`. The `sol.state`, `sol.costate` and `sol.control` are functions that return the state, costate and control trajectories at a given time. + - The `norm` function is from `LinearAlgebra.jl`. + - The `∘` operator is the composition operator. Hence, `norm∘u` is the function `t -> norm(u(t))`. + - The `sol.state`, `sol.costate` and `sol.control` are functions that return the state, costate and control trajectories at a given time.