Homework 6
Homework 6
Homework 6
1. Given: A water tower (SDF system) has the following dynamic properties as shown in Figure
(a). It is subjected to the half-sine-wave loading shown in Figure (b). Neglect damping and
assume that the tower is initiated at rest.
Required:
1) Using the Trapezoidal Method, determine the displacement response history of the system
to the given half-cycle sine pulse force for the first 3.0 second by using the time interval
∆t = 0.1 second. Include your MATLAB code in your submission.
2) Repeat (1) by using the time interval ∆t = 0.05 second.
3) Evaluate the theoretical solution. Compare with the numerical solution in 1) and 2) above.
Display the difference between your numerical answer and analytical answer.
4) Using the Simpson’s Method, determine the displacement response history of the system to
the given half-cycle sine pulse force for the first 2.0 second by using the time interval
∆t = 0.1 second.
5) Submit a figure using MATLAB containing all four plots as required above.
>> % MATLAB Code for Water Tower Displacement Response to Half-Sine
Wave Force
% Given Parameters
w = 978.8; % Weight of the tower in kips
k = 100; % Stiffness in kips/in
g = 386.4; % Acceleration due to gravity in in/s^2
m = w / g; % Mass of the tower in kips-s^2/in
wn = sqrt(k / m); % Natural frequency of the system in rad/s
% Time setup
t_end = 3.0; % Total time for response calculation
dt1 = 0.1; % First time step interval in seconds
dt2 = 0.05; % Second time step interval in seconds
time1 = 0:dt1:t_end; % Time vector for dt = 0.1 sec
time2 = 0:dt2:t_end; % Time vector for dt = 0.05 sec
for i = 1:length(time1)-1
t = time1(i);
t_next = time1(i+1);
% External force at current and next time step
P_current = force(t);
P_next = force(t_next);
for i = 1:length(time2)-1
t = time2(i);
t_next = time2(i+1);
% External force at current and next time step
P_current = force(t);
P_next = force(t_next);
figure;
plot(time1, abs(diff_dt1), 'b', 'DisplayName', '|Numerical - Theoretical|
(dt = 0.1 s)');
hold on;
plot(time1, abs(diff_dt2), 'r--', 'DisplayName', '|Numerical - Theoretical|
(dt = 0.05 s)');
xlabel('Time (s)');
ylabel('Absolute Difference (in)');
legend;
title('Difference Between Numerical and Theoretical Solutions');
>>
Trapezoidal Numerical Integration MATLAB
For Displacement Response Histo
Eora mit in ku
m
t
I tming It é
A sinwalt e de
If
figit f fn sina.coswpt coswot.sinwofd
n
B gleldt E
g T
ig t Sin WDT
Trapezoidal Method
A Flo 2 f 20 7 24130 f 24 Cn Dots f n ot
20 t 3413017 29 In Dot not
B 910 2g g
St 0.1 sec
% MATLAB Code for Water Tower Displacement Response
using Trapezoidal Method
% Given Parameters
w = 978.8; % Weight of the tower in kips
k = 100; % Stiffness in kips/in
g = 386.4; % Acceleration due to gravity in in/s^2
m = w / g; % Mass of the tower in kips-s^2/in
wn = sqrt(k / m); % Natural frequency of the system in
rad/s P_max: Sets the maximum force of the
half-sine wave.
% Define the force function P(t)
P_max = 100; % Peak force in kips T_half: Defines the duration (0.6 seconds)
T_half = 0.6; % Duration of half sine wave in of the half-sine wave.
seconds
force = @(t) (t <= T_half) .* (P_max * sin(pi * t / T_half)); % force: Uses an anonymous function to
Piecewise force function define P(t), which applies the half-sine force
until T_half and is zero afterward. This
models an impulse-type load that acts over
a short time.
% Time setup
t_end = 3.0; % Total time for response calculation t_end: Sets the simulation duration to 3
dt1 = 0.1; % First time step interval in seconds seconds.
dt2 = 0.05; % Second time step interval in seconds
time1 = 0:dt1:t_end; % Time vector for dt = 0.1 sec dt1, dt2: Defines the two time intervals,
time2 = 0:dt2:t_end; % Time vector for dt = 0.05 sec Δt=0.1 sec and Δt=0.05 sec, for numerical
analysis.
for i = 1:length(time1)-1
% Current time and next time step Loop (for i = 1:length(time1)-1): Iterates
t = time1(i); through each time point in time1 to
t_next = time1(i+1); calculate displacement and velocity.
% External force at current and next time step t, t_next: Sets the current time (t) and the
P_current = force(t); next time (t_next) in time1.
P_next = force(t_next);
P_current, P_next: Calculates the external
force at the current (t) and next (t_next)
time steps using the force function.
% Trapezoidal method for displacement and velocity a_current: Calculates the current
a_current = (P_current - k * u1(i)) / m; % Current acceleration acceleration using
u_pred = u1(i) + dt1 * v1(i) + (dt1^2 / (2 * m)) * (P_current - k * u1(i));
v_pred = v1(i) + (dt1 / 2) * (a_current + (P_next - k * u_pred) / m);
% Trapezoidal method for displacement and velocity Similar calculations for acceleration,
a_current = (P_current - k * u2(i)) / m; % Current displacement prediction, velocity
acceleration prediction, and updating u2 and v2
u_pred = u2(i) + dt2 * v2(i) + (dt2^2 / (2 * m)) * (P_current - k * arrays for each time step in time2.
u2(i));
v_pred = v2(i) + (dt2 / 2) * (a_current + (P_next - k * u_pred) /
m);