��Chapter 3�Euler-Lagrange Equations
Euler-Lagrange Equations
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
2
Potential Energy
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
3
Generalized Coordinates and Forces
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
4
Friction and Any Other External Force
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
5
Friction and Any Other External Force
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
6
Friction and Any Other External Force
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
7
Design Study A
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
8
Design Study A
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
9
Design Study B
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
10
Design Study B
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
11
Design Study B
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
12
Design Study C
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
13
Design Study C
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
14
Design Study C
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
15
Appendix P.4�Numerical Solutions to Differential Equations
16
Numerically Solving an ODE
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
17
Numerically Solving an ODE
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
18
Euler Method / Runge-Kutta 1 (RK1)
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
19
Euler Method / Runge-Kutta 1 (RK1)
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
20
import numpy as np
class systemDynamics:
# Model the system yddot + a1*ydot + a2*sin(y) = b*u
def __init__(self, Ts=0.01):
self.Ts = Ts # sample rate
# Specify the initial condition
y0 = 0.0 # y at time zero
ydot0 = 0.0 # ydot at time zero
self.state = np.array([[y0], [ydot0]]) # state at time zero
self.a1 = 2.0
self.a2 = 2.0
self.b = 4.0
def update(self, u):
# This is the external method that takes the input u and
# returns the output y.
self.rk1_step(u) # propagate the state by one time sample
y = self.h() # return the corresponding output
return y
def rk1_step(self, u):
# Integrate ODE using Runge-Kutta RK1 algorithm
F1 = self.f(self.state, u)
self.state = self.state + self.Ts * F1
Runge-Kutta 2 (RK2)
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
21
Runge-Kutta 2 (RK2)
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
22
import numpy as np
�
class systemDynamics:
# Model the system yddot + a1*ydot + a2*sin(y) = b*u
def __init__(self, Ts=0.01):
self.Ts = Ts # sample rate
# Specify the initial condition
y0 = 0.0 # y at time zero
ydot0 = 0.0 # ydot at time zero
self.state = np.array([[y0],[ydot0]]) # state at time zero
self.a1 = 2.0
self.a2 = 2.0
self.b = 4.0�
def update(self, u):
# This is the external method that takes the input u and
# returns the output y.
self.rk2_step(u) # propagate the state by one time sample
y = self.h() # return the corresponding output
return y�
def rk2_step(self, u):
# Integrate ODE using Runge-Kutta RK2 algorithm
F1 = self.f(self.state, u)
F2 = self.f(self.state + self.Ts / 2 * F1, u)
self.state += self.Ts / 2 * (F1 + F2)
Runge-Kutta 4 (RK4)
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
23
Runge-Kutta 4 (RK4)
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
24
import numpy as np
�
class systemDynamics:
# Model the system yddot + a1*ydot + a2*sin(y) = b*u
def __init__(self, Ts=0.01):
self.Ts = Ts # sample rate
# Specify the initial condition
y0 = 0.0 # y at time zero
ydot0 = 0.0 # ydot at time zero
self.state = np.array([[y0],[ydot0]]) # state at time zero
self.a1 = 2.0
self.a2 = 2.0
self.b = 4.0�
def update(self, u):
# This is the external method that takes the input u and
# returns the output y.
self.rk4_step(u) # propagate the state by one time sample
y = self.h() # return the corresponding output
return y�
def rk4_step(self, u):
# Integrate ODE using Runge-Kutta RK4 algorithm
F1 = self.f(self.state, u)
F2 = self.f(self.state + self.Ts / 2 * F1, u)
F3 = self.f(self.state + self.Ts / 2 * F2, u)
F4 = self.f(self.state + self.Ts * F3, u)
self.state += self.Ts / 6 * (F1 + 2 * F2 + 2 * F3 + F4)
Design Study A
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
25
Design Study A
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
26
Design Study B
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
27
Design Study B
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
28
Design Study C
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
29
Design Study C
Introduction to Feedback Control, Beard, McLain, Peterson, Killpack
30