0% found this document useful (0 votes)
52 views42 pages

MATLAB Oscillation & Damping Analysis

Uploaded by

Mamdud Mithu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views42 pages

MATLAB Oscillation & Damping Analysis

Uploaded by

Mamdud Mithu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

EMCH 561 – HW 01

A1
A2:
A2 - 4.

Discussion: oscillation start from initial position at time t = 0; and then continues with same
amplitude and frequency.

MATLAB code:

%%
fprintf('A.2 - 1:\n')
% Inputs
g = 9.8; % m/s^2
L = 0.55; % meter
m = 50; % kg

L_list = [551.05, 551.55, 547.27, 551.59, 550.05, 547.11, 548.10, 549.57,


551.84, 551.87]/1000;

% 1a rad/sec natural frequency ωn


omega_n = 1 ./ (2 * pi) * (g ./ L_list);
% 1b Hz natural frequency fn
fn = omega_n / (2*pi);

% 1c period of oscillation τ
tau = 1 ./ fn;

% 1d display in table format

table = [L_list; omega_n; fn; tau];


% disp(table)
fprintf('Length List:\n')
disp(L_list)
fprintf('Angular Frequency List:\n')
disp(omega_n)
fprintf('Hz Frequency List:\n')
disp(fn)
fprintf('Period List:\n')
disp(tau)

% 2 Means
fprintf('A.2 - 2:\n')
mean_omega_n = mean(omega_n);
mean_fn = mean(fn);
mean_tau = mean(tau);
fprintf('Mean angular Frequwncy (rad/sec):\n')
disp(mean_omega_n)
fprintf('Mean Hz Frequwncy (Hz):\n')
disp(mean_fn)
fprintf('Mean Period of Oscillation (sec):\n')
disp(mean_tau)

% 3 IVP
fprintf('A.2 - 3:\n')
uo = 2/1000; % meter
uo_dot = 0.3; % initial velocity

% 3a Displacement at t1 = 10 sec
t1 = 10; % sec
ut = uo * cos(mean_omega_n * t1) + (uo_dot / mean_omega_n) * sin(mean_omega_n
* t1);
fprintf('Position of the Mass after 10 sec:\n')
disp(ut)

% Plot the undamped displacement in the first figure


t_10_osc = 10*mean_tau;
fprintf('Duration of 10 Oscillations:\n')
disp(t_10_osc)
ut_10_osc = uo * cos(mean_omega_n * t_10_osc) + (uo_dot / mean_omega_n) *
sin(mean_omega_n * t_10_osc);
fprintf('Displacement after 10 Oscillations:\n')
disp(ut_10_osc)
t_10 = linspace(0, t_10_osc, 1000);
figure(1);

u = uo * cos(mean_omega_n * t_10) + (uo_dot / mean_omega_n) *


sin(mean_omega_n * t_10);
plot(t_10, u, 'k', 'LineWidth', 0.4);
xlabel('Time (s)');
ylabel('Displacement (m)');
title('Undamped Displacement');
grid on;
A.3

A.3-5 a-b:

Max response: 0.0352273 m

Response at 10 seconds: -0.03466 m

Discussion: Oscillation starts from rest and continues with same amplitudes and frequency due to
no damping.

MATLAB code:

%% A.3
g = 9.81; % m/s^2 (gravitational acceleration)
L = 550 / 1000; % m (pendulum length)
M = 50; % kg (mass of pendulum)
Uo = 0; % Initial displacement
Vo = 0; % Initial velocity

m = 8 / 1000; % kg (mass of projectile)


v = 930; % m/s (velocity of projectile)

% A.3 - 1) Display input data (just print in the console in MATLAB)


disp('A.3-1: Input Data:');
fprintf('Gravitational Acceleration (g): %.2f m/s^2\n', g);
fprintf('Length of Pendulum (L): %.2f m\n', L);
fprintf('Mass of Pendulum (M): %.2f kg\n', M);
fprintf('Mass of Projectile (m): %.4f kg\n', m);
fprintf('Velocity of Projectile (v): %.2f m/s\n', v);

% A.3 - 2) Initial velocity of the system


udot_o = m * v / (M + m); % initial velocity after the impact
fprintf('A.3-2: Initial Velocity of the system (u_dot_0): %.4f m/s\n', udot_o);

% A.3 - 3) Rad/sec natural frequency & period of oscillation


omega_n = sqrt(g / L); % rad/sec natural frequency
tau = 2 * pi / omega_n; % period of oscillation
fprintf('A.3-3: Natural frequency (omega_n): %.4f rad/s\n', omega_n);
fprintf('A.3-3: Period of oscillation (tau): %.4f sec\n', tau);

% A.3 - 4) Displacement function


displacement = @(initial_u, initial_v, t, omega) initial_u * cos(omega * t) +
(initial_v / omega) * sin(omega * t);

% A.3 - 5) Response u(t1) after t1 = 10 sec


t1 = 10; % seconds
u_10sec = displacement(Uo, udot_o, t1, omega_n);
fprintf('A.3-4: Displacement after t1 = 10 sec: %.4f m\n', u_10sec);

% A.3 - 6) Plot the response for Nosc = 10


Nosc = 10;
t_Nosc = Nosc * tau; % total time for 10 oscillations
t = linspace(0, t_Nosc, 1000); % time vector
u_Nosc = displacement(Uo, udot_o, t, omega_n); % displacement over time

% Plotting the response


figure;
plot(t, u_Nosc, 'LineWidth', 1.5);
xlabel('Time (sec)', 'FontSize', 12);
ylabel('Displacement (m)', 'FontSize', 12);
title('Harmonic Response of the Pendulum after Impact', 'FontSize', 14);
grid on;
B.1
B.2
B3

11)

a. maximum response = 0.00198825 m

b. response after one oscillation = 0.00100306 m

c. time of displacement less than 2% of initial displacement = 4.07802 sec

Discussion: underdamped system takes longer to reach equilibrium position. Decay is slow.
MATLAB Code:

%% Part B.3
clear; clc
% Damped displacement
m = 8; % kg
k = 600; % N/m
c = 15; % N/(m/s)
uo = 2/1000; % m
udot_o = 0; % m/s
% 1) display input data
disp('B.3 - 1: Input Data:');
fprintf('Mass (m): %.2f kg\n', m);
fprintf('Spring constant (k): %.2f N/m\n', k);
fprintf('Damping coefficient (c): %.2f N/(m/s)\n', c);
fprintf('Initial displacement (uo): %.4f m\n', uo);
fprintf('Initial velocity (udot_o): %.2f m/s\n', udot_o);
% 2) Calculate the natural frequency in rad/sec omega_n and in Hz f_n
omega_n = sqrt(k / m); % rad/sec
f_n = omega_n / (2 * pi); % Hz
fprintf('2) Natural frequency (omega_n): %.4f rad/s, (f_n): %.4f Hz\n',
omega_n, f_n);

% 3) Critical damping c_cr


c_cr = 2 * sqrt(m * k);
fprintf('3) Critical damping (c_cr): %.4f N/(m/s)\n', c_cr);

% 4) Damping ratio zeta


zeta = c / c_cr;
fprintf('4) Damping ratio (zeta): %.4f\n', zeta);
% 5) Calculate the damped frequency in rad/sec omega_d and in Hz f_d
omega_d = omega_n * sqrt(1 - zeta^2);
f_d = omega_d / (2 * pi);
fprintf('5) Damped frequency (omega_d): %.4f rad/s, %.4f Hz\n', omega_d, f_d);

% 6) Calculate the damped period of oscillation tau_d


tau_d = 1 / f_d;
fprintf('6) Damped period (tau_d): %.4f s\n', tau_d);

% 7) Characteristic-equation roots s1, s2 and constants C1, C2


s1 = -zeta * omega_n + 1i * omega_d;
s2 = -zeta * omega_n - 1i * omega_d;

C1 = (-s2 * uo + udot_o) / (s1 - s2);


C2 = (s1 * uo + udot_o) / (s1 - s2);
fprintf('7) \ns1 = %.4f, s2 = %.4f, C1 = %.4f, C2 = %.4f rad\n', s1, s2, C1,
C2);
% 8) Calculate the constants A, B and then the constants C, phi
A = C1 + C2;
B = 1i * (C1 - C2);
C = abs(A); % Using absolute value to handle complex numbers

% phi = atan2(real(B), real(A)); % In MATLAB, atan2 handles phase computation


properly
phi = atan(A/B)
fprintf('8)\nA = %.4f, B = %.4f, C = %.4f, phi = %.4f rad\n', A, B, C, phi);

% Define the damped displacement function


damped_u = @(omega_nat, omega_dam, Zeta, C_const, phi_phase, time) ...
C_const * exp(-Zeta * omega_nat * time) .* sin(omega_dam * time +
phi_phase);
% 9) Calculate the duration t1 of one oscillation and the corresponding position
u1=u(t1)
t1 = tau_d
u_at_t1 = damped_u(omega_n, omega_d, zeta, C, phi, t1);
fprintf('9) Duration of one oscillation = %.4f s\nCorresponding displacement =
%.6f m\n', t1, u_at_t1);

% 10) Calculate 2% of the initial displacement


u2 = uo * 0.02;
fprintf('10) 2%% of initial displacement = %.6f m\n', u2);

% 11) plot
Nosc = 10;
tNosc = Nosc * tau_d;
t_span = linspace(0, tNosc, 2000); % Time span for 10 oscillations
u_span = damped_u(omega_n, omega_d, zeta, C, phi, t_span); % Displacement over
time

% Plotting the damped response


figure;
plot(t_span, u_span, 'LineWidth', 1.5);
xlabel('Time [s]', 'FontSize', 12);
ylabel('Displacement [m]', 'FontSize', 12);
title(['Damped response \zeta = ' num2str(round(zeta*100, 2)) '%'], 'FontSize',
14);
grid on;
B4
Discussion: Damping causes the oscillation to decay over time towards a steady state equilibrium
position.
Discussion: lower damping takes more time to reach equilibrium position and oscillates for longer.

MATLAB code

%% B4
clear; clc;
% Define the damped displacement function
damped_u = @(omega_nat, omega_dam, Zeta, C_const, phi_phase, time) ...

C_const * exp(-Zeta * omega_nat * time) .* sin(omega_dam * time +


phi_phase);
% Given constants
L = 900 / 1000; % m (length of the beam)
h = 6 / 1000; % m (height of the beam)
b = 80 / 1000; % m (width of the beam)
E = 200e9; % Pa (Young's modulus of steel)
m = 475; % kg (mass apportioned to the wheel)
u_o = 150 / 1000; % m (initial displacement)
udot_o = 0; % m/s (initial velocity)
% 1) Display input data
disp('1 )Input Data:');
fprintf('Length of beam (L): %.4f m\n', L);
fprintf('Height of beam (h): %.4f m\n', h);
fprintf('Width of beam (b): %.4f m\n', b);
fprintf('Youngs Modulus (E): %.2e Pa\n', E);
fprintf('Mass (m): %.2f kg\n', m);
fprintf('Initial displacement (u_o): %.4f m\n', u_o);
fprintf('Initial velocity (udot_o): %.2f m/s\n', udot_o);

% 2) Calculate the second moment of area I of the beam cross-section


I = (1/12) * b * h^3;
fprintf('2) Second moment of area (I): %.6e m^4\n', I);

% 3) Calculate the flexural stiffness EI of the beam


flexural_stiffness = E * I;
fprintf('3) Flexural stiffness (EI): %.6e Nm^2\n', flexural_stiffness);

% 4) Calculate the spring constant k of the system for a simply supported


beam
k = (48 * flexural_stiffness) / L^3;
fprintf('4) Spring constant (k): %.2f N/m\n', k);

% 5) Calculate the natural frequency in rad/sec (omega_n) and in Hz (f_n)


omega_n = sqrt(k / m); % Natural frequency in rad/sec
f_n = omega_n / (2 * pi); % Natural frequency in Hz
fprintf('5) Natural frequency (omega_n): %.4f rad/s\n', omega_n);
fprintf('5) Natural frequency (f_n): %.4f Hz\n', f_n);

% 6) Calculate the critical damping coefficient ccr


c_cr = 2 * sqrt(k * m); % Critical damping coefficient
fprintf('6) Critical damping coefficient (c_cr): %.2f Ns/m\n', c_cr);

% Given damping ratio


zeta = 0.10; % 25% damping ratio

% 7) Calculate the physical damping c


c = 2 * zeta * sqrt(k * m); % Physical damping
fprintf('7) Damping ratio (zeta): %.2f\n', zeta);
fprintf(' Physical damping (c): %.2f Ns/m\n', c);

% 8) Calculate the damped frequency in rad/sec (omega_d) and in Hz (f_d)


omega_d = omega_n * sqrt(1 - zeta^2); % Damped frequency in rad/sec
f_d = omega_d / (2 * pi); % Damped frequency in Hz
fprintf('8) Damped frequency (omega_d): %.4f rad/s\n', omega_d);
fprintf(' Damped frequency (f_d): %.4f Hz\n', f_d);

% 9) damped period of oscillation tau_d


tau_d = 1/f_d;
fprintf('9) period of oscillation (f_d): %.4f rad/sec', tau_d);
% 10) Calculate characteristic-equation roots s1 and s2
s1 = -zeta * omega_n + 1i * omega_d;
s2 = -zeta * omega_n - 1i * omega_d;

% 11) Calculate constants C1 and C2


C1 = (-s2 * u_o + udot_o) / (s1 - s2);
C2 = (s1 * u_o + udot_o) / (s1 - s2);

% Display results
fprintf('\nCharacteristic-equation roots:\n');
fprintf('s1 = %.4f + %.4fi\n', real(s1), imag(s1));
fprintf('s2 = %.4f + %.4fi\n', real(s2), imag(s2));

fprintf('\n10) Constants:\n');
fprintf('C1 = %.4f + %.4fi\n', real(C1), imag(C1));
fprintf('C2 = %.4f + %.4fi\n', real(C2), imag(C2));

% 11) Calculate the constants A, B and then the constants C, phi


A = C1 + C2; B = 1i*(C1 - C2);
C = sqrt(A^2 + B^2); phi = atan(A/B);
fprintf('A = %.4f; B = %.4f\n', A, B);
fprintf('C = %.4f; phi = %.4f\n', C, phi);

% 12) duration t1 of one oscillation and the corresponding position u1=u(t1)


t1 = tau_d;
u1_at_t1 = damped_u(omega_n, omega_d, zeta, C, phi, t1);
fprintf('12) t1 = %.4f; position at t1 = %.4f\n', t1, u1_at_t1);

% 13) Calculate the value u0.02 representing 2% of the initial displacement


u2 = u_o * 0.02;
fprintf('13) u2: %.4f m\n', u2);
Nosc=10;
tNosc = tau_d * Nosc;
t_span = linspace(0, tNosc, 2000);

u_span = damped_u(omega_n, omega_d, zeta, C, phi, t_span); % Displacement


over time

% Plotting the damped response


figure;
plot(t_span, u_span, 'LineWidth', 1.5);
xlabel('Time [s]', 'FontSize', 12);
ylabel('Displacement [m]', 'FontSize', 12);
title(['Damped response of TRUCK SUSPENSION \zeta = ' num2str(round(zeta*100,
2)) '%'], 'FontSize', 14);
grid on;
B5

3a

3b

3c

3d

zeta=2.5
3e

4a

4b

4c

4d
4e

Critical Damping

Critical damping occurs when the damping ratio (ζ=1\zeta = 1ζ=1) results in the fastest return to
equilibrium without oscillating. It is commonly sought after for systems like vehicle
suspensions when a quick return to a stable state is required after an impact (e.g., going over
bumps).

Pros:

1. Fast Response Time:

o Critical damping offers the fastest return to equilibrium without any oscillations.
This can be beneficial in race cars when the vehicle needs to stabilize quickly
after disturbances, like going over bumps or corners.

2. Maximum Stability:

o The system returns to its neutral position as quickly as possible without


overshooting. This can help maintain better control and stability, especially at
high speeds.

3. Optimized for Handling:


o Critical damping strikes a balance between comfort and performance, allowing
for sharp handling while maintaining some level of comfort for the driver.

Cons:

1. Potential for Harsh Ride:

o While critical damping helps in control, it can lead to a slightly harsher ride than
softer suspension systems. The system is tuned for performance, not comfort,
which might lead to driver fatigue over long races.

2. Less Energy Absorption:

o Critical damping doesn't absorb as much energy as overdamping. As a result, the


system may transmit more of the road's irregularities directly to the chassis,
which could reduce the car's traction on uneven surfaces.

Overdamped Design

Overdamping occurs when the damping ratio (ζ>1\zeta > 1ζ>1) is greater than critical damping.
In an overdamped system, the suspension returns to equilibrium more slowly than in critical
damping, but without oscillating.

Pros:

1. Smooth Ride:

o Overdamped systems provide a smoother, more comfortable ride by absorbing


more of the impact from bumps or uneven road surfaces. This can prevent
excessive vibration from being transmitted to the car's body and driver,
especially in endurance races.

2. More Controlled Movements:

o The slower return to equilibrium can lead to more controlled movements,


reducing the chance of aggressive rebounds after hitting bumps or curbs. This
may be useful on tracks with many irregularities.

Cons:

1. Slower Response:

o The main downside of overdamping is that it slows down the return to


equilibrium, meaning the car might take longer to stabilize after an impact or a
turn. This could negatively impact handling and cornering performance,
especially in fast-paced racing environments.

2. Reduced Handling Precision:

o The slower recovery of the suspension can lead to less precise handling when
the car is required to make quick adjustments or navigate tight corners. This
might be undesirable in race cars designed for sharp, high-speed maneuvers.
3. Potential for Reduced Performance on Smooth Tracks:

o Overdamping can be unnecessary and even detrimental on smooth tracks where


quick recovery from bumps or disturbances isn't required. In this case, the
overdamped system could reduce overall responsiveness.

MATLAB code:

%% B.5 OVERDAMPED SPRING-MASS-DAMPER SYSTEMS


clear;clc
% Given data
fn = 3; % natural frequency in Hz
u_o = 10 / 1000; % initial displacement in meters (10 mm)
udot_o = 0;
zeta = 2.5; % damping ratio (can vary)

% Constants
omega_n = 2 * pi * fn; % natural angular frequency in rad/s

% Expressions for s1 and s2


s1 = -zeta * omega_n + omega_n * sqrt(zeta^2 - 1);
s2 = -zeta * omega_n - omega_n * sqrt(zeta^2 - 1);

C1 = (-s2 * u_o + udot_o) / (s1 - s2);


C2 = (s1 * u_o + udot_o) / (s1 - s2);

fprintf('\nCharacteristic-equation roots:\n');
fprintf('s1 = %.4f + %.4fi\n', real(s1), imag(s1));
fprintf('s2 = %.4f + %.4fi\n', real(s2), imag(s2));

fprintf('\n10) Constants:\n');
fprintf('C1 = %.4f + %.4fi\n', real(C1), imag(C1));
fprintf('C2 = %.4f + %.4fi\n', real(C2), imag(C2));

overdamped_u = @(C_1, C_2, s_1, s_2, time) ...


C_1 * exp(s_1 * time) + C_2 * exp(s_2 * time);

t_span = linspace(0, 3, 2000);


u_span = overdamped_u(C1, C2, s1, s2, t_span);

% Plotting the over damped response


figure;
plot(t_span, u_span, 'LineWidth', 1.5);
xlabel('Time [s]', 'FontSize', 12);
ylabel('Displacement [m]', 'FontSize', 12);
title(['Over Damped system \zeta = ' num2str(round(zeta, 2))], 'FontSize',
14);
grid on;

%% Critically Damped System


% Given data
zeta = 1; % critically damped system
fn = 3; % natural frequency in Hz
omega_n = 2 * pi * fn; % natural angular frequency in rad/s
u_o = 10 / 1000; % initial displacement in meters (10 mm)
udot_o = 0; % initial velocity (assumed to be zero)

% Constants for critically damped system


C1 = u_o;
C2 = udot_o + omega_n * u_o;

% Critically damped response function


criticallydamped_u = @(C1, C2, omega_n, time) ...
(C1 + C2 .* time) .* exp(-omega_n .* time);

% Time span
t_span = linspace(0, 3, 2000);

% Displacement over time


u_span = criticallydamped_u(C1, C2, omega_n, t_span);

% Plotting the critically damped response


figure;
plot(t_span, u_span, 'LineWidth', 1.5);
xlabel('Time [s]', 'FontSize', 12);
ylabel('Displacement [m]', 'FontSize', 12);
title(['Critically Damped System \zeta = ' num2str(round(zeta, 2))],
'FontSize', 14);
grid on;
B6

1 Assumptions:

The system is linear which means the governing equation is a linear ODE

2 FBD:

3 NLM:

4 EOM

5
6

10

You might also like