For the example problem 2.2.4 (page 20, textbook or page 3,
ClassNote Wk#3), the system is oscillating without any external
excitation. Parameters are given as follows. (Picture
Posted)
initial conditions:
= 0.5 rad/sec,
(0) = 2
degrees
Mass of the bar: 5kgm
Moment of inertia of the bar about O: Jo= 0.1 kg-m2
Spring constant: k = 150 N/m
Dimentions: a= 0.5 m; b= 1.5 m; c= 0.5 m
Using the MATLAB, plot the angular displacement, angular velocity and angular acceleration of the system.
Note: Use an appropriate time vector to show at least 3 cycles.
Governing Equation:

Given:
kg-m2 ,
N/m ,
m,
m,
,
kg,
rad/s and
Converting the second order differential equation to first order for MATLAB calculation, Let

Then,
or
Also,
Time Period for one cycle
MATLAB CODE
clear
clc
k=150
a=0.5
b=1.5
J0=1
tspan = 0:0.001:1;
y0 = [0.035, 0.5];
opts = odeset('RelTol',1e-2,'AbsTol',1e-4);
sol = ode45(@(t,y) odefun(t,y,k,a,b,J0), tspan, y0, opts);
t = linspace(0,1,1000);
y = deval(sol,t);
% plot(t,y(1,:)) %Plot angular displacement vs t
% plot(t,y(2,:)) %Plot angular velocity vs t
acc=-k*(a^2+b^2)/J0*y(1,:);
plot(t,acc) % Angular acceleration vs Time
function dydt = odefun(t,y,k,a,b,J0)
dydt = zeros(2,1);
dydt(1) = y(2);
dydt(2) = -k*(a^2+b^2)/J0*y(1);
end



For the example problem 2.2.4 (page 20, textbook or page 3, ClassNote Wk#3), the system is...