Skip to content

Commit 6d6b4b9

Browse files
committed
rm linear analysis example, placed in issue instead
1 parent 113146c commit 6d6b4b9

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

docs/src/tutorials/noise.md

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -83,28 +83,6 @@ figu = plot(noise_sol, idxs=noisy_model.source.V.u, label = "Control signal [V]"
8383
plot(figy, figu, plot_title = "DC Motor with Discrete-time Speed Controller")
8484
```
8585

86-
## Linear analysis of noise
87-
Propagation of Gaussian noise through linear time-invariant systems is well understood, the stationary covariance of the output can be computed by solving a Lyapunov equation. Unfortunately, ModelingToolkit models that contain both continuous time and discrete time components cannot yet be linearized and linear analysis is thus made slightly harder. Below, we instead use a data-driven linearization approach where we use recorded signals from the simulation and fit a linear model using subspace-based identification. The function `subspaceid` below is provided by the package [ControlSystemIdentification.jl](https://baggepinnen.github.io/ControlSystemIdentification.jl/stable/).
88-
89-
We let the angular velocity of the inertia be the output, and the output of the noise block as well as the output of the load disturbance be the inputs.
90-
91-
```@example NOISE
92-
using ControlSystemIdentification, ControlSystemsBase
93-
Tf = 20
94-
prob2 = remake(noise_prob, p=Dict(noisy_model.load_step.height=>0.0), tspan=(0.0, Tf))
95-
noise_sol = solve(prob2, Tsit5())
96-
tv = 0:0.002:Tf
97-
y = noise_sol(tv, idxs=noisy_model.inertia.w) |> vec
98-
un = noise_sol(tv, idxs=noisy_model.noise.y)-y |> vec
99-
ud = noise_sol(tv, idxs=noisy_model.load_step.output.u) |> vec
100-
d = iddata(y', [un ud]', 0.002)
101-
lsys,_ = newpem(d, 4, focus=:simulation, zeroD=false)
102-
```
103-
With an LTI model available, we can ask for the theoretical output covariance we should obtain if we feed a white noise signal with covariance matrix ``0.1^2 I`` through the noise input of the system. We compare this to the actual output covariance obtained from the simulation (discarding the initial transient as well as the transient caused by the load disturbance).
104-
```@example NOISE
105-
sqrt(covar(lsys[1,1],0.1^2*I)), std(y[[50:648; 750:end]])
106-
```
107-
10886
## Noise filtering
10987
No discrete-time filter components are available yet. You may, e.g.
11088
- Add exponential filtering using `xf(k) ~ (1-α)xf(k-1) + α*x(k)`, where `α` is the filter coefficient and `x` is the signal to be filtered.

0 commit comments

Comments
 (0)