-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathivp.jl
89 lines (63 loc) · 1.99 KB
/
ivp.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
"""
InitialValueProblem{S <: AbstractSystem, XT} <: AbstractSystem
Parametric composite type for initial value problems. It is parameterized in the
system's type and the initial state's type
### Fields
- `s` -- system
- `x0` -- initial state
### Examples
The linear system ``x' = -x`` with initial condition ``x₀ = [-1/2, 1/2]``:
```jldoctest
julia> s = LinearContinuousSystem([-1.0 0.0; 0.0 -1.0]);
julia> x₀ = [-1/2, 1/2];
julia> p = InitialValueProblem(s, x₀);
julia> initial_state(p) # same as p.x0
2-element Vector{Float64}:
-0.5
0.5
julia> statedim(p)
2
julia> inputdim(p)
0
```
"""
struct InitialValueProblem{S<:AbstractSystem,XT} <: AbstractSystem
s::S
x0::XT
end
statedim(ivp::InitialValueProblem) = statedim(ivp.s)
stateset(ivp::InitialValueProblem) = stateset(ivp.s)
inputdim(ivp::InitialValueProblem) = inputdim(ivp.s)
inputset(ivp::InitialValueProblem) = inputset(ivp.s)
noisedim(ivp::InitialValueProblem) = noisedim(ivp.s)
noiseset(ivp::InitialValueProblem) = noiseset(ivp.s)
islinear(ivp::InitialValueProblem) = islinear(ivp.s)
isaffine(ivp::InitialValueProblem) = isaffine(ivp.s)
ispolynomial(ivp::InitialValueProblem) = ispolynomial(ivp.s)
state_matrix(ivp::InitialValueProblem) = state_matrix(ivp.s)
input_matrix(ivp::InitialValueProblem) = input_matrix(ivp.s)
noise_matrix(ivp::InitialValueProblem) = noise_matrix(ivp.s)
affine_term(ivp::InitialValueProblem) = affine_term(ivp.s)
"""
initial_state(ivp::InitialValueProblem)
Return the initial state of an initial-value problem.
### Input
- `ivp` -- initial-value problem
### Output
The initial state of an initial-value problem.
"""
initial_state(ivp::InitialValueProblem) = ivp.x0
"""
system(ivp::InitialValueProblem)
Return the system wrapped by an initial-value problem.
### Input
- `ivp` -- initial-value problem
### Output
The system of the given initial-value problem.
"""
system(ivp::InitialValueProblem) = ivp.s
"""
IVP
`IVP` is an alias for `InitialValueProblem`.
"""
const IVP = InitialValueProblem