Skip to content

Commit

Permalink
tidy up new tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
baggepinnen committed Jun 8, 2022
1 parent 362239e commit f4672a9
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ControlSystemIdentification"
uuid = "3abffc1c-5106-53b7-b354-a47bfc086282"
authors = ["baggepinnen <[email protected]>"]
version = "2.2.8"
version = "2.3.0"

[deps]
ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
Expand All @@ -11,6 +11,7 @@ DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LowLevelParticleFilters = "d9d29d28-c116-5dba-9239-57a5fe23875b"
MatrixEquations = "99c1a7ee-ab34-5fd5-8076-27c950a045f4"
Expand Down
2 changes: 1 addition & 1 deletion docs/src/examples/ballandbeam.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ predplot(model, dval, h=1)
predplot!(model, dval, h=10, ploty=false)
predplot!(model, dval, h=20, ploty=false)
```
The figures above show the result of predicting $h=\left{1, 10, 20\right}$ steps into the future. Since the process is unstable, simulation is not feasible, and already 20 steps prediction shows tendencies towards being unstable.
The figures above show the result of predicting $h={1, 10, 20}$ steps into the future. Since the process is unstable, simulation is not feasible, and already 20 steps prediction shows tendencies towards being unstable.

We can visualize the estimated models in the frequency domain as well. We show both the model estimated using PEM and a nonparametric estimate using a Fourier-based method ([`tfest`](@ref)), this method estimates a noise model as well.

Expand Down
5 changes: 3 additions & 2 deletions docs/src/examples/evaporator.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,20 @@ Before we estimate any model, we inspect the data
plot(d, layout=6)
```

We split the data in two, and use the first part for estimation and the second for validation. A model of order around 8 is reasonable (the paper uses 6-13). This system requires zeroD=false to be able to capture a direct feedthrough, otherwise the fit will always be rather poor.
We split the data in two, and use the first part for estimation and the second for validation. A model of order around 8 is reasonable (the paper uses 6-13). This system requires the option `zeroD=false` to be able to capture a direct feedthrough, otherwise the fit will always be rather poor.
```@example evaporator
dtrain = d[1:end÷2]
dval = d[end÷2:end]
model,_ = newpem(dtrain, 8, zeroD=false)
nothing # hide
```

```@example evaporator
predplot(model, dval, h=1, layout=d.ny)
predplot!(model, dval, h=5, ploty=false)
```
The figures above show the result of predicting $h=\left{1, 5\right}$ steps into the future.
The figures above show the result of predicting $h={1, 5}$ steps into the future.

We can visualize the estimated model in the frequency domain as well.
```@example evaporator
Expand Down
4 changes: 2 additions & 2 deletions docs/src/examples/flexible_robot.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ predplot(model, dval, h=1)
predplot!(model, dval, h=10, ploty=false)
simplot!(model, dval, ploty=false)
```
The figures above show the result of predicting $h=\left{1, 10, \infty\right}$ steps into the future.
The figures above show the result of predicting $h={1, 10, \infty}$ steps into the future.

We can visualize the estimated models in the frequency domain as well. We show both the model estimated using PEM and a nonparametric estimate using a Fourier-based method ([`tfest`](@ref)), this method estimates a noise model as well.

```@example robot
w = exp10.(LinRange(-1, log10(pi/d.Ts), 200))
bodeplot(model.sys, w, lab="PEM", plotphase=false)
plot!(tfest(d))
plot!(tfest(d), legend=:bottomleft)
```
It looks like the model fails to capture the notches accurately. Estimating zeros is known to be hard, both in practice and in theory.
3 changes: 2 additions & 1 deletion docs/src/examples/glass_furnace.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ dtrain = d[1:2end÷3]
dval = d[2end÷3:end]
model = subspaceid(dtrain, 7, zeroD=false)
nothing # hide
```
We can have a look at the $D$ matrix in the estimated model
```@example furnace
Expand All @@ -40,7 +41,7 @@ We validate the model by prediction on the validation data:
predplot(model, dval, h=1, layout=6)
predplot!(model, dval, h=10, ploty=false)
```
The figures above show the result of predicting $h=\left{1, 10\right}$ steps into the future.
The figures above show the result of predicting $h={1, 10}$ steps into the future.

We can visualize the estimated model in the frequency domain as well.
```@example furnace
Expand Down
7 changes: 7 additions & 0 deletions docs/src/examples/hair_dryer.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,10 @@ plot!(tfest(d))
```
The two parametric models are quite similar and agree well with the nonparametric estimate. We also see that the nonparametric estimate becomes rather noisy above 10 rad/s, something we could predict based on the coherence function.

We can compare the impulse responses of the estimated model to the impulse response that was estimated directly from data above:
```@example dryer
impulseestplot(d, 40, σ=3, lab="Data", seriestype=:steppost)
plot!(impulse(model_pem, 3), lab="PEM")
plot!(impulse(model_arx, 3), lab="ARX")
```
The ARX model has an impulse response that is exactly zero for the first three samples since we indicated `inputdelay=3` when estimating this model. The PEM model did not know this, but figured it out from the data nevertheless.

0 comments on commit f4672a9

Please sign in to comment.