Wolfram.com
WolframAlpha.com
WolframCloud.com
Wolfram Language
Example Repository
Ready-to-use examples for the Wolfram Language
Primary Navigation
Categories
Astronomy
Audio Processing
Calculus
Cellular Automata
Chemistry
Complex Systems
Computer Science
Computer Vision
Control Systems
Creative Arts
Data Science
Engineering
Finance & Economics
Finite Element Method
Food & Nutrition
Geography
Geometry
Graphs & Networks
Image Processing
Life Sciences
Machine Learning
Mathematics
Optimization
Physics
Puzzles and Recreation
Quantum Computation
Signal Processing
Social Sciences
System Modeling
Text & Language Processing
Time-Related Computation
Video Processing
Visualization & Graphics
Alphabetical List
Submit a New Resource
Learn More about
Wolfram Language
Related Pages
Related Symbols
StateSpaceModel
LQRegulatorGains
StateResponse
OutputResponse
Related Categories
Control Systems
Engineering
System Modeling
Control the Pitch and Depth of a Submarine
Design a controller that tracks the submarine's depth
Example Notebook
Open in Cloud
Download Notebook
A state-space model of the submarine's longitudinal dynamics:
I
n
[
1
]
:
=
s
u
b
m
a
r
i
n
e
=
S
t
a
t
e
S
p
a
c
e
M
o
d
e
l
a
b
c
d
,
l
a
b
e
l
s
O
u
t
[
1
]
=
δ
δ
s
-
0
.
0
3
8
0
0
6
0
.
8
9
6
0
4
0
0
.
0
0
1
4
6
7
3
-
0
.
0
0
7
5
4
2
-
0
.
0
2
2
8
5
9
0
.
0
0
1
7
1
0
5
0
.
0
9
1
9
7
6
0
-
0
.
0
0
5
6
0
9
5
0
.
0
0
1
7
3
2
3
-
0
.
0
0
2
2
2
1
7
1
0
0
-
3
.
0
8
6
7
0
0
θ
0
1
0
0
0
0
0
0
1
0
0
0
θ
0
0
0
1
0
0
Without a controller, the submarine's pitch and depth are unstable to a disturbance in the states:
I
n
[
2
]
:
=
O
u
t
p
u
t
R
e
s
p
o
n
s
e
[
{
s
u
b
m
a
r
i
n
e
,
{
1
,
0
,
0
.
5
,
0
.
2
}
}
,
{
0
,
0
}
,
{
t
,
0
,
2
0
}
]
;
P
l
o
t
#
1
,
{
t
,
0
,
2
0
}
,
p
l
o
t
O
p
t
s
&
/
@
T
h
r
e
a
d
[
{
%
,
{
,
θ
}
}
]
O
u
t
[
2
]
=
Set the depth
and pitch
θ
, which are outputs 1 and 2, as tracked outputs:
I
n
[
3
]
:
=
s
s
p
e
c
=
"
I
n
p
u
t
M
o
d
e
l
"
s
u
b
m
a
r
i
n
e
,
"
T
r
a
c
k
e
d
O
u
t
p
u
t
s
"
{
1
,
2
}
;
Specify a set of control weights and a sampling period:
I
n
[
4
]
:
=
w
t
s
=
D
i
a
g
o
n
a
l
M
a
t
r
i
x
[
{
5
,
5
,
1
0
,
1
0
,
3
1
0
,
3
1
0
}
]
,
3
1
0
I
d
e
n
t
i
t
y
M
a
t
r
i
x
[
2
]
;
τ
=
0
.
2
;
Compute the discrete-time LQR controller:
I
n
[
5
]
:
=
d
l
q
r
=
D
i
s
c
r
e
t
e
L
Q
R
e
g
u
l
a
t
o
r
G
a
i
n
s
[
s
s
p
e
c
,
w
t
s
,
τ
,
"
D
a
t
a
"
]
O
u
t
[
5
]
=
S
y
s
t
e
m
s
M
o
d
e
l
C
o
n
t
r
o
l
l
e
r
D
a
t
a
D
e
s
i
g
n
:
d
i
s
c
r
e
t
e
l
i
n
e
a
r
q
u
a
d
r
a
t
i
c
r
e
g
u
l
a
t
o
r
»
F
e
e
d
b
a
c
k
i
n
p
u
t
s
c
o
u
n
t
:
2
Obtain the closed-loop system:
I
n
[
6
]
:
=
d
c
s
y
s
=
d
l
q
r
[
"
D
i
s
c
r
e
t
e
T
i
m
e
C
l
o
s
e
d
L
o
o
p
S
y
s
t
e
m
"
]
O
u
t
[
6
]
=
0
.
9
1
9
6
6
9
0
.
2
2
8
6
1
8
-
0
.
0
2
4
0
3
1
1
0
.
2
0
0
0
2
-
0
.
0
0
1
4
7
1
5
4
-
0
.
0
0
4
5
9
4
4
8
0
.
0
.
0
.
0
0
3
9
6
2
2
4
0
.
8
9
7
9
4
9
0
.
0
0
0
6
2
5
9
2
4
-
0
.
0
2
3
1
5
1
1
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
-
0
.
1
2
0
2
1
5
-
0
.
1
5
0
7
3
3
0
.
1
2
0
2
1
5
0
.
1
5
0
7
3
3
0
.
0
.
0
.
0
.
1
.
0
.
0
.
0
.
0
.
0
.
2
1
.
7
6
3
1
-
2
5
3
.
9
5
6
.
0
3
2
2
4
-
8
4
.
2
4
7
1
0
.
1
.
0
.
0
.
0
.
0
.
8
.
8
7
2
3
5
7
0
.
7
9
9
3
3
.
2
9
8
4
1
-
1
6
.
5
1
0
3
0
.
2
The inputs to the controller model:
I
n
[
1
0
]
:
=
c
i
n
p
s
=
J
o
i
n
[
T
a
b
l
e
[
{
-
1
0
,
0
}
,
7
5
0
]
,
s
r
〚
{
3
,
4
,
1
,
2
,
3
,
4
}
〛
]
;
The control effort:
I
n
[
1
1
]
:
=
L
i
s
t
S
t
e
p
P
l
o
t
O
u
t
p
u
t
R
e
s
p
o
n
s
e
[
c
m
,
c
i
n
p
s
]
,
p
l
o
t
O
p
t
s
O
u
t
[
1
1
]
=
Source Metadata
Citation:
Grimble, van der Molen and Liceaga-Castro 1993, Submarine Depth and Pitch Control
Related Symbols
StateSpaceModel
LQRegulatorGains
StateResponse
OutputResponse
Publisher Information
Contributed by:
Wolfram Controls Team