In this assignment we will study the modeling of complex mechanical systems based on the Lagrange approach.
Problem 1 (Ball on a Beam)
We will use the Generalized Coordinates .
a)
The position of the ball’s center as a function in the -frame, of the generalized coordinates can be expressed as
b)
Rolling gives
Tilting the beam gives
In total this gives
c)
We have both kinetic energy due to translation
Link to originalWhere is given by
Giving us
And kinetic energy due to the rotation is given by
So the ball has kinetic energy
d)
The kinetic energy of the beam is
e)
The following changes in BallAndBeamSimulation.m
We find the Generalized Forces,
Where is the torque
.
.
.
% Define symbolic variable q for the generalized coordinates
% x and theta
q = [x; theta];
% Define symbolic variable dq for the derivatives
% of the generalized coordinates
dq = [dx; dtheta];
% Write the expressions for the position of
% the center of the ball:
p = [
x*cos(theta)-R*sin(theta);
0;
x*sin(theta) + R*cos(theta)
];
% Kinetic energy
T = 1/2*J*dtheta^2; % kinetic energy of beam
dp = jacobian(p,q)*dq; % linear velocity of ball
T = T + 1/2*M*(dp.')*dp; % add linear kinetic energy of ball
I = 2/5*M*R^2*eye(3); % inertia in rotation of ball
omega = [0; dx/R+dtheta; 0]; % angular velocity of ball
T = T + 1/2 *(omega.')*I*omega; % add rotational kinetic energy of ball
T = simplify(T);
% Potential energy
V = M*g*p(3);
% Generalized forces
Q = [0; -To];
% Lagrangian
Lag = T-V;
.
.
.
f)
We assume that the external torque is given by the PD control law
Idk how to do this task
Problem 2 (Pendulum on an Oscillator)
a)
We set
b)
The kinetic energy is given by
c)
The potential energy of the system is given by
d)
We have
Link to originalWhere
The Lagrange functions is defined as Where is the Kinetic Energy, and is the Potential Energy.
Link to original
Which gives
And
Which gives