@@ -66,7 +66,7 @@ values in FBS2e.
6666
6767We begin by defining the dynamics of the system
6868
69- .. code-block ::
69+ .. code-block :: python
7070
7171 import control
7272 import numpy as np
@@ -96,7 +96,7 @@ We begin by defining the dynamics of the system
9696
9797 We now create an input/output system using these dynamics:
9898
99- .. code-block ::
99+ .. code-block :: python
100100
101101 io_predprey = control.NonlinearIOSystem(
102102 predprey_rhs, None , inputs = (' u' ), outputs = (' H' , ' L' ),
@@ -108,7 +108,7 @@ will be used as the output of the system.
108108The `io_predprey ` system can now be simulated to obtain the open loop dynamics
109109of the system:
110110
111- .. code-block ::
111+ .. code-block :: python
112112
113113 X0 = [25 , 20 ] # Initial H, L
114114 T = np.linspace(0 , 70 , 500 ) # Simulation 70 years of time
@@ -127,7 +127,7 @@ We can also create a feedback controller to stabilize a desired population of
127127the system. We begin by finding the (unstable) equilibrium point for the
128128system and computing the linearization about that point.
129129
130- .. code-block ::
130+ .. code-block :: python
131131
132132 eqpt = control.find_eqpt(io_predprey, X0, 0 )
133133 xeq = eqpt[0 ] # choose the nonzero equilibrium point
@@ -137,7 +137,7 @@ We next compute a controller that stabilizes the equilibrium point using
137137eigenvalue placement and computing the feedforward gain using the number of
138138lynxes as the desired output (following FBS2e, Example 7.5):
139139
140- .. code-block ::
140+ .. code-block :: python
141141
142142 K = control.place(lin_predprey.A, lin_predprey.B, [- 0.1 , - 0.2 ])
143143 A, B = lin_predprey.A, lin_predprey.B
@@ -149,7 +149,7 @@ applies a corrective input based on deviations from the equilibrium point.
149149This system has no dynamics, since it is a static (affine) map, and can
150150constructed using the `~control.ios.NonlinearIOSystem ` class:
151151
152- .. code-block ::
152+ .. code-block :: python
153153
154154 io_controller = control.NonlinearIOSystem(
155155 None ,
@@ -162,7 +162,7 @@ populations followed by the desired lynx population.
162162To connect the controller to the predatory-prey model, we create an
163163`InterconnectedSystem `:
164164
165- .. code-block ::
165+ .. code-block :: python
166166
167167 io_closed = control.InterconnectedSystem(
168168 (io_predprey, io_controller), # systems
@@ -177,7 +177,7 @@ To connect the controller to the predatory-prey model, we create an
177177
178178 Finally, we simulate the closed loop system:
179179
180- .. code-block ::
180+ .. code-block :: python
181181
182182 # Simulate the system
183183 t, y = control.input_output_response(io_closed, T, 30 , [15 , 20 ])
0 commit comments