Skip to content

Commit e963a68

Browse files
committed
doc: remove plot call in sim! examples
1 parent 2162978 commit e963a68

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

src/plot_sim.jl

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Manually construct a `SimResult` to quickly plot `obj` simulations.
2222
2323
Except for `obj`, all the arguments should be matrices of `N` columns, where `N` is the
2424
number of time steps. [`SimResult`](@ref) objects allow to quickly plot simulation results.
25-
Simply call `plot` from [`Plots.jl`](https://github.com/JuliaPlots/Plots.jl) on them.
25+
Simply call `plot` on them.
2626
2727
# Arguments
2828
!!! info
@@ -39,7 +39,7 @@ Simply call `plot` from [`Plots.jl`](https://github.com/JuliaPlots/Plots.jl) on
3939
- `Ru_data` : manipulated input setpoints
4040
4141
# Examples
42-
```julia-repl
42+
```jldoctest
4343
julia> plant = LinModel(tf(1, [1, 1]), 1.0); N = 5; U_data = fill(1.0, 1, N);
4444
4545
julia> Y_data = reduce(hcat, (updatestate!(plant, U_data[:, i]); plant()) for i=1:N)
@@ -48,9 +48,6 @@ julia> Y_data = reduce(hcat, (updatestate!(plant, U_data[:, i]); plant()) for i=
4848
4949
julia> res = SimResult(plant, U_data, Y_data)
5050
Simulation results of LinModel with 5 time steps.
51-
52-
julia> using Plots; plot(res)
53-
5451
```
5552
"""
5653
function SimResult(
@@ -108,18 +105,15 @@ Open-loop simulation of `plant` for `N` time steps, default to unit bump test on
108105
The manipulated inputs ``\mathbf{u}`` and measured disturbances ``\mathbf{d}`` are held
109106
constant at `u` and `d` values, respectively. The plant initial state ``\mathbf{x}(0)`` is
110107
specified by `x_0` keyword arguments. The function returns [`SimResult`](@ref) instances
111-
that can be visualized by calling `plot` from [`Plots.jl`](https://github.com/JuliaPlots/Plots.jl)
112-
on them (see Examples below). Note that the method mutates `plant` internal states.
108+
that can be visualized by calling `plot` on them. Note that the method mutates `plant`
109+
internal states.
113110
114111
# Examples
115-
```julia-repl
112+
```jldoctest
116113
julia> plant = NonLinModel((x,u,d)->0.1x+u+d, (x,_)->2x, 10.0, 1, 1, 1, 1, solver=nothing);
117114
118115
julia> res = sim!(plant, 15, [0], [0], x_0=[1])
119116
Simulation results of NonLinModel with 15 time steps.
120-
121-
julia> using Plots; plot(res, plotu=false, plotd=false, plotx=true)
122-
123117
```
124118
"""
125119
function sim!(
@@ -184,16 +178,13 @@ vectors. The simulated sensor and process noises of `plant` are specified by `y_
184178
- `lastu = plant.uop` : last plant input ``\mathbf{u}`` for ``\mathbf{x̂}`` initialization
185179
186180
# Examples
187-
```julia-repl
181+
```jldoctest
188182
julia> model = LinModel(tf(3, [30, 1]), 0.5);
189183
190184
julia> estim = KalmanFilter(model, σR=[0.5], σQ=[0.25], σQint_ym=[0.01], σPint_ym_0=[0.1]);
191185
192186
julia> res = sim!(estim, 50, [0], y_noise=[0.5], x_noise=[0.25], x_0=[-10], x̂_0=[0, 0])
193187
Simulation results of KalmanFilter with 50 time steps.
194-
195-
julia> using Plots; plot(res, plotŷ=true, plotu=false, plotxwithx̂=true)
196-
197188
```
198189
"""
199190
function sim!(
@@ -222,16 +213,13 @@ The output and manipulated input setpoints are held constant at `ry` and `ru`, r
222213
The keyword arguments are identical to [`sim!(::StateEstimator, ::Int)`](@ref).
223214
224215
# Examples
225-
```julia-repl
216+
```jldoctest
226217
julia> model = LinModel([tf(3, [30, 1]); tf(2, [5, 1])], 4);
227218
228219
julia> mpc = setconstraint!(LinMPC(model, Mwt=[0, 1], Nwt=[0.01], Hp=30), ymin=[0, -Inf]);
229220
230221
julia> res = sim!(mpc, 25, [0, 0], y_noise=[0.1], y_step=[-10, 0])
231222
Simulation results of LinMPC with 25 time steps.
232-
233-
julia> using Plots; plot(res, plotry=true, plotŷ=true, plotymin=true, plotu=true)
234-
235223
```
236224
"""
237225
function sim!(

0 commit comments

Comments
 (0)