You are on page 1of 12

Newton's Equations

System Model Free-Body Diagram


𝑭

𝒍
𝜽 𝒍 𝒎𝒈𝒔𝒊𝒏𝜽
𝒎
𝒎𝒈𝒄𝒐𝒔𝜽
𝒎 𝒔
𝜽

𝒔 𝒎𝒈
𝜽=
𝒍
𝒅𝒔 𝒅𝜽 𝒅𝟐 𝒔 𝒅𝟐 𝜽
𝒔 = 𝒍𝜽 𝒔ሶ = =𝒍 𝒔ሷ = 𝟐 = 𝒍 𝟐
𝒅𝒕 𝒅𝒕 𝒅𝒕 𝒅𝒕
Newton’s Second Law Equation of Motion
𝒎

෍𝐹 = 0
𝒅𝟐 𝜽
𝒎𝒍 𝟐 = −𝒎𝒈𝒔𝒊𝒏𝜽
𝒅𝒕
𝒈 Equation of
𝒎𝒍𝜽ሷ = −𝒎𝒈𝒔𝒊𝒏𝜽 𝜽ሷ = − 𝒔𝒊𝒏𝜽 Motion
𝒍
Lagrange's Equations
System Model

𝜽 𝒍
𝜽 𝒍 𝒚 = −𝒍𝒄𝒐𝒔𝜽

𝒎
𝒎 𝒙 = 𝒍𝒔𝒊𝒏𝜽
Derivatives

Kinematic Constraints Velocities


𝒙 = 𝒍𝒔𝒊𝒏𝜽 𝒅
𝒙ሶ = 𝒍𝒔𝒊𝒏𝜽 = 𝒍 𝒄𝒐𝒔 𝜽 𝜽ሶ
𝒅𝒕
𝒅
𝒚 = −𝒍𝒄𝒐𝒔𝜽 𝒚ሶ = 𝒍𝒄𝒐𝒔𝜽 = −𝒍 𝒔𝒊𝒏 𝜽 𝜽ሶ
𝒅𝒕
Kinetic Energy (T)
𝟏 𝟏
𝑻 = 𝒎𝒗 = 𝒎 𝒙ሶ 𝟐 + 𝒚ሶ 𝟐
𝟐
𝟐 𝟐
𝟏
𝑻 = 𝒎 𝒍𝟐 𝒄𝒐𝒔𝟐 𝜽𝜽ሶ 𝟐 + 𝒍𝟐 𝒔𝒊𝒏𝟐 𝜽𝜽ሶ 𝟐 𝒄𝒐𝒔𝟐 𝜽 + 𝒔𝒊𝒏𝟐 𝜽 = 𝟏
𝟐
𝟏 𝟐 𝟐
𝑻 = 𝒎𝒍 𝜽ሶ
𝟐
Potential Energy (U)

𝑼 = 𝒎𝒈𝒉 𝑼 = −𝒎𝒈𝒍𝒄𝒐𝒔𝜽

Lagrangian Equation
General
The Lagrangian(𝓛) of a system is defined to be the difference
of the kinetic energy and the potential energy.

𝓛=𝑻−𝑼
𝟏 𝟐 𝟐
𝓛 = 𝒎𝒍 𝜽ሶ + 𝒎𝒈𝒍𝒄𝒐𝒔𝜽
𝟐
Euler - Lagrangian Equation

𝒅 𝝏𝓛 𝝏𝓛
− =𝟎
𝒅𝒕 𝝏𝜽ሶ 𝝏𝜽
𝝏𝓛
= −𝒎𝒈𝒍𝒔𝒊𝒏𝜽
𝝏𝜽

𝝏𝓛
= 𝒎𝒍𝟐 𝜽ሶ
𝝏𝜽ሶ 𝒎𝒍𝟐 𝜽ሷ − −𝒎𝒈𝒍𝒔𝒊𝒏𝜽 = 𝟎

𝒅 𝝏𝓛 𝒈
= 𝒎𝒍𝟐 𝜽ሷ 𝜽ሷ = 𝒔𝒊𝒏𝜽
𝒅𝒕 𝝏𝜽ሶ 𝒍
Energy Method
System Model

𝜽 𝒍
𝜽 𝒍 𝒉 = 𝒍𝒄𝒐𝒔𝜽

𝒎
𝒎 𝒔
Derivatives

Kinematic Constraints Velocities

𝒔 = 𝒍𝜽 𝒗 = 𝒍𝜽ሶ

Kinetic Energy (K) Potential Energy (U)


𝟏
𝑻 = 𝒎𝒗𝟐 𝑼 = 𝒎𝒈𝒉
𝟐
𝟏 𝟐 𝟐
𝑻 = 𝒎𝒍 𝜽ሶ 𝑼 = 𝒎𝒈𝒍𝒄𝒐𝒔𝜽
𝟐

𝒌=𝑻+𝑼 𝒌 = 𝒄𝒐𝒏𝒔𝒕𝒂𝒏𝒕
Energy Method

𝒌=𝑻+𝑼

𝟏 𝟐 𝟐
𝒌 = 𝒎𝒍 𝜽ሶ − 𝒎𝒈𝒍𝒄𝒐𝒔𝜽
𝟐
𝟎
𝒅 𝟏 𝟐 𝟐 𝒅

𝒎𝒍 𝜽 − 𝒎𝒈𝒍𝒄𝒐𝒔𝜽 = 𝒌
𝒅𝒕 𝟐 𝒅𝒕

𝒅 𝟏 𝟐
𝒎𝒍 𝒍𝜽ሶ − 𝒈𝒄𝒐𝒔𝜽 = 𝟎
𝒅𝒕 𝟐
𝒅 𝟏 𝟐
𝒎𝒍 = 𝟎 𝒍𝜽ሶ − 𝒈𝒄𝒐𝒔𝜽 = 𝟎
𝒅𝒕 𝟐

𝟏 𝒅 𝟐 𝒅
𝒍 𝜽ሶ − 𝒈 𝒄𝒐𝒔𝜽 = 𝟎
𝟐 𝒅𝒕 𝒅𝒕

𝟏 𝟐
𝒍 𝟐𝜽ሶ 𝜽ሷ − 𝒈(−𝜽𝒔𝒊𝒏𝜽)
ሶ =𝟎
𝟐

𝜽ሶ 𝒍𝜽ሷ − 𝒈𝒔𝒊𝒏𝜽 = 𝟎
𝒈
𝜽ሶ = 𝟎 𝒍𝜽ሷ − 𝒈𝒔𝒊𝒏𝜽 = 𝟎 𝜽ሷ = 𝒔𝒊𝒏𝜽
𝒍
𝒔𝒊𝒏𝜽 ≈ 𝜽
Hamilton's Equations
The Lagrangian is

𝟏 𝟐 𝟐
𝓛 = 𝒎𝒍 𝜽ሶ + 𝒎𝒈𝒍𝒄𝒐𝒔𝜽
𝟐

The conjugate momentum is


𝝏𝓛 𝒑𝜽
𝒑𝜽 = = 𝒎𝒍𝟐 𝜽ሶ 𝜽ሶ =
𝝏𝜽ሶ 𝒎𝒍𝟐

and so the Hamiltonian 𝜽 is

𝑯 = ෍ 𝜽ሶ 𝒊 𝒑𝜽𝒊 − 𝑳
𝒒

𝒑𝜽 𝟏 𝟐 𝟐
𝑯= 𝒑 𝜽 − 𝒎𝒍 𝜽ሶ + 𝒎𝒈𝒍𝒄𝒐𝒔𝜽
𝒎𝒍𝟐 𝟐

𝒑𝜽 𝟐
𝑯= 𝟐
− 𝒎𝒈𝒍𝒄𝒐𝒔𝜽
𝟐𝒎𝒍
Hamilton's Equations

Hamilton’s equations are generalized coordinate 𝜽 are

𝝏𝑯 𝝏𝑯
𝜽ሶ 𝒊 = 𝒑𝜽𝒊 =−
𝝏𝒑𝜽𝒊 𝝏𝜽𝒊

𝝏𝑯 𝝏 𝒑𝜽 𝟐 𝒑𝜽
𝜽ሶ 𝒊 = = 𝟐
− 𝒎𝒈𝒍𝒄𝒐𝒔𝜽 =
𝝏𝒑𝜽𝒊 𝝏𝒑𝜽𝒊 𝟐𝒎𝒍 𝒎𝒍𝟐

𝝏𝑯 𝝏 𝒑𝜽 𝟐
𝒑𝜽ሶ = − =− 𝟐
− 𝒎𝒈𝒍𝒄𝒐𝒔𝜽 = −𝒎𝒈𝒍𝒔𝒊𝒏𝜽
𝝏𝜽𝒊 𝝏𝜽 𝟐𝒎𝒍

If various operations are performed

𝒑𝜽
𝜽ሶ 𝒊 = 𝒑𝜽 = 𝒎𝒍𝟐 𝜽ሶ 𝒑𝜽ሶ = 𝒎𝒍𝟐 𝜽ሷ
𝒎𝒍𝟐

𝒑𝜽ሶ = 𝒎𝒍𝟐 𝜽ሷ 𝒑𝜽ሶ = −𝒎𝒈𝒍𝒔𝒊𝒏𝜽

𝒎𝒍𝟐 𝜽ሷ = −𝒎𝒈𝒍𝒔𝒊𝒏𝜽
𝒍𝜽ሷ = −𝒈𝒔𝒊𝒏𝜽
𝒍𝜽ሷ + 𝒈𝒔𝒊𝒏𝜽 = 𝟎
𝒈
𝜽ሷ = 𝒔𝒊𝒏𝜽 𝒔𝒊𝒏𝜽 ≈ 𝜽
𝒍
System Modeling and Simulation
PYTHON - MATLAB
System Modeling and Simulation
PYTHON

1. Import of necessary libraries

import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import solve_ivp

2. Define Lagrange equations

def lagrangian_equations(t, y, m, L, g):


theta, omega = y
dydt = [omega, -(g/L) * np.sin(theta)]
return dydt

3. Initial conditions

theta0 = 0.1 # Initial angle (in radians)


omega0 = 0.0 # Initial angular velocity
y0 = [theta0, omega0]

4. Defining variables 5. Time range

m = 1.0 # Mass t_start = 0.0

L = 1.0 # Length of the pendulum t_end = 10.0

g = 9.8 # Acceleration due to gravity num_points = 1000


t = np.linspace(t_start, t_end, num_points)
6. Solving differential equation

sol = solve_ivp(lagrangian_equations, [t_start, t_end], y0, t_eval=t, args=(m, L, g))

7. Plot the results


plt.plot(sol.t, sol.y[0])
plt.xlabel(‘Time (s)')
plt.ylabel('Angle (radians)')
plt.title(')
plt.grid(True) 'Angle of the Simple Pendulum
plt.show()
System Modeling and Simulation
MATLAB
1. Defining variables
m = 1.0; % Mass
L = 1.0; % Length of the pendulum
g = 9.8; % Acceleration due to gravity

2. Initial conditions
theta0 = 0.1; % Initial angle (in radians)
omega0 = 0.0; % Initial angular velocity
y0 = [theta0; omega0];

3. Time range
t_start = 0.0;
t_end = 10.0;
num_points = 1000;
t = linspace(t_start, t_end, num_points);

4. Define Lagrange equations


lagrangian_equations = @(t, y) [y(2); -(g/L) * sin(y(1))];
5. Solving differential equation
options = odeset('RelTol', 1e-6, 'AbsTol', 1e-6);
[t, sol] = ode45(lagrangian_equations, t, y0, options);

6. Plot the results


plot(t, sol(:, 1))
xlabel('Time (s)')
ylabel('Angle (radians)')
title('Angle of the Simple Pendulum')
grid on

You might also like