% HHT-alpha Method For A 5-DOF Mass
% HHT-alpha Method For A 5-DOF Mass
%% System Parameters
n = 5; % Number of degrees of freedom
% Mass matrix (assume unit mass for each DOF for simplicity)
M = eye(n);
%% External Force
numSteps = floor(t_max / dt) + 1;
F = zeros(n, numSteps); % External force matrix (size: n x numSteps)
F(1, 1:floor(numSteps/4)) = 1; % Apply a step force to the first DOF for the first
quarter of the simulation
%% Initial Conditions
U0 = zeros(n, 1); % Initial displacement vector
V0 = zeros(n, 1); % Initial velocity vector
figure;
for i = 1:n
subplot(n, 3, 3*(i-1)+1);
plot(time, U(i, :), 'b');
title(['Displacement of DOF ', num2str(i)]);
xlabel('Time (s)');
ylabel('Displacement (m)');
subplot(n, 3, 3*(i-1)+2);
plot(time, V(i, :), 'r');
title(['Velocity of DOF ', num2str(i)]);
xlabel('Time (s)');
ylabel('Velocity (m/s)');
subplot(n, 3, 3*(i-1)+3);
plot(time, A(i, :), 'g');
title(['Acceleration of DOF ', num2str(i)]);
xlabel('Time (s)');
ylabel('Acceleration (m/s^2)');
end
% Initial conditions
U(:, 1) = U0;
V(:, 1) = V0;
A(:, 1) = M \ (F(:, 1) - C * V(:, 1) - K * U(:, 1));