A basic example: the linear pendulum


Pendulum: linear modeling with Lagrange's approach

> restart: libname := libname, "C:/MBSymba": with(MBSymba_r6):

> PDEtools[declare]([theta(t)],prime=t,quiet):

Define the body frame

> TP := rotate('Z',theta(t)) * translate(0,-L,0);

Define the body

> pendulum := make_BODY(TP,m,0,0,IG): show(pendulum);

kinetic energy

> KE := simplify(kinetic_energy(pendulum));

> KE2 := taylorF(KE, diff(theta(t),t),3);

Define acceleration due to gravity

> _gravity := make_VECTOR(ground,0,-g,0): show(_gravity);

potential energy

> PE:= gravitational_energy(pendulum);

> PE2 := taylorF(PE, theta(t),3);

non linear equations

> eqnNL := lagrange(KE-PE,theta(t),t);
eqnL := linearize(eqnNL,theta(t));

linear Lagrangian equation

> eqnL := lagrange(KE2-PE2,theta(t),t);

>

>

Pendulum: full linear modeling with Newton's approach

> restart: libname := libname, "C:/MBSymba": with(MBSymba_r6):

> PDEtools[declare]([theta(t)],prime=t,quiet):

> Describe(linear_modeling);

# Define a set of parameters that should be considered small. Expressions

# containing these parameters are automatically linearized. When a parameter is

# time dependent, expressions are linearized also with respect its time

# derivatives. Case position, the first two derivatives are computed, case

# velocity only the first derivative.

linear_modeling( position::{set, list, name} := {},

velocity::{set, list, name} := {},

vars::{set, list, name} := {}, $ )

> linear_modeling({theta(t)});

Warning, Linear Modeling option has been choosen for the following variables:

Define the body frame

> TP := rotate('Z',theta(t)) * translate(0,-L,0);

Define the body

> pendulum := make_BODY(TP,m,0,0,IG): show(pendulum);

Define acceleration due to gravity

> _gravity := make_VECTOR(ground,0,-g,0): show(_gravity);

Define the pin joint A

> A := origin(ground): show(A);

Reaction force (body coordinates)

> make_VECTOR(TP,TA,RA,0):
RF := make_FORCE(%, A, pendulum): show(RF);

> eqnE := euler_equations({pendulum,RF},A): show(eqnE);

>

>

Comments are closed.