Test 1 MatLAB
Course: MEC521
Name: AZHAR BIN BAHARUDDIN
Student ID: 2012455876
Group: EMD5M3A
Basic Calculations:
Equation of Motion:
+ + = 0
Where;
Equivalent mass, =
Equivalent damping constant, =
Equivalent spring constant, =
Initial/Known data:
Damping ratio, = 0.1
Mass, = 1
Spring constant, = 100 /
Initial displacement, 0 = 0.02
Initial velocity, 0 = 0 /
Calculated data:
100
Natural frequency, = = = = 10 /
1
Damping frequency, = 1 2 = 101 0.12 = 9.95 /
2 2
Damping period, = = 9.95 = 0.63
Time taken to complete 5 cycles; 5 = 5 = 5 0.63 = 3.16
Response equation:
Since the damping ratio is 0.1, the system is considered as underdamped. Therefore, the response
equation (after inserting all the related data) is:
() = (. . + . . )
MatLAB Script:
% This is Test 1 Matlab
% Course : MEC521
% Name : AZHAR BIN BAHARUDDIN
% Student ID: 2012455876
% Group: EMD5M3A
zeta = 0.1; % Damping ratio
m = 1; % Mass
k = 100; % Spring constant
wn = sqrt(k/m); % Natural frequency
x0 = 0.02; % Initial displacement
x0_dot = 0; % Initial velocity
wd = wn * sqrt(1 - zeta^2); % Damping frequency
for i = 1: 101 % Start of loop function to calculate the system response's
cycle
t(i) = (5 * 2 * pi / wn) * (i-1)/100; % Limits the system response graph
to 5 cycles ONLY
x(i) = exp(-zeta * wn * t(i)) * (x0 * cos(wd*t(i)) + ((x0_dot + zeta * wn
* x0) * sin (wd*t(i))/wd)); % System response function
end % End of loop function
plot (t, x); % Plots the graph of system response
ylabel ('Vertical Displacement, x(t)'); % Labels the y-axis of the graph
xlabel ('Time, t'); % Labels the x-axis of the graph
title ('MatLAB Test 1') % Labels the title of the graph
System Response Graph: