0% found this document useful (0 votes)
14 views3 pages

% HHT-alpha Method For A 5-DOF Mass

This document outlines a MATLAB script that implements the HHT-alpha method for solving the equations of motion of a 5-degree-of-freedom mass-spring-damper system. It includes the definition of system parameters, time integration parameters, external forces, and initial conditions, followed by a function that performs the HHT-alpha integration. The results are then plotted for displacement, velocity, and acceleration for each degree of freedom over the simulation time.

Uploaded by

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

% HHT-alpha Method For A 5-DOF Mass

This document outlines a MATLAB script that implements the HHT-alpha method for solving the equations of motion of a 5-degree-of-freedom mass-spring-damper system. It includes the definition of system parameters, time integration parameters, external forces, and initial conditions, followed by a function that performs the HHT-alpha integration. The results are then plotted for displacement, velocity, and acceleration for each degree of freedom over the simulation time.

Uploaded by

koulliredouane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

% HHT-alpha Method for a 5-DOF Mass-Spring-Damper System

% This script solves M * U'' + C * U' + K * U = F


% using the HHT-alpha time integration method.

%% System Parameters
n = 5; % Number of degrees of freedom

% Mass matrix (assume unit mass for each DOF for simplicity)
M = eye(n);

% Damping matrix (assuming proportional damping)


c_val = 0.1; % Damping coefficient
C = c_val * eye(n);

% Stiffness matrix for a 5-DOF system with springs of stiffness k


k_val = 10; % Stiffness of each spring
K = diag(2 * k_val * ones(n, 1)) - diag(k_val * ones(n-1, 1), 1) - diag(k_val *
ones(n-1, 1), -1);

%% Time Integration Parameters


dt = 0.01; % Time step (s)
t_max = 2; % Total simulation time (s)
alpha = -0.1; % HHT-alpha parameter (typically between -0.3 and 0)

% Derived parameters for HHT-alpha method


gamma = 0.5 * (1 - 2 * alpha);
beta = (1 - alpha)^2 / 4;

%% 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

%% Call the HHT-alpha Function


[U, V, A] = HHT_alpha(M, C, K, F, dt, t_max, alpha, U0, V0);

%% Plot Results for Each Degree of Freedom


time = 0:dt:t_max;

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

%% HHT-alpha Function Definition


function [U, V, A] = HHT_alpha(M, C, K, F, dt, t_max, alpha, U0, V0)
% HHT-alpha method for solving M * U'' + C * U' + K * U = F
% Inputs:
% M : Mass matrix
% C : Damping matrix
% K : Stiffness matrix
% F : External force vector (size: numDOF x numSteps)
% dt : Time step
% t_max : Maximum simulation time
% alpha : HHT-alpha parameter (usually between -0.3 and 0)
% U0 : Initial displacement
% V0 : Initial velocity
%
% Outputs:
% U : Displacement vector
% V : Velocity vector
% A : Acceleration vector

% Derived HHT parameters


gamma = 0.5 * (1 - 2 * alpha);
beta = (1 - alpha)^2 / 4;

% Number of time steps


numSteps = floor(t_max / dt) + 1;
numDOF = size(M, 1); % Number of degrees of freedom

% Initialize response vectors


U = zeros(numDOF, numSteps); % Displacement
V = zeros(numDOF, numSteps); % Velocity
A = zeros(numDOF, numSteps); % Acceleration

% Initial conditions
U(:, 1) = U0;
V(:, 1) = V0;
A(:, 1) = M \ (F(:, 1) - C * V(:, 1) - K * U(:, 1));

% Effective stiffness matrix


K_eff = (1 + alpha) * K + gamma / (beta * dt) * (1 + alpha) * C + 1 / (beta *
dt^2) * M;

% Time integration loop


for i = 2:numSteps
% Effective force vector
F_eff = (1 + alpha) * F(:, i) + ...
M * (1 / (beta * dt^2) * U(:, i-1) + 1 / (beta * dt) * V(:, i-1) +
(0.5 / beta - 1) * A(:, i-1)) + ...
C * (gamma / (beta * dt) * U(:, i-1) + (gamma / beta - 1) * V(:, i-
1) + dt * (gamma / (2 * beta) - 1) * A(:, i-1));

% Solve for displacement at the next time step


U(:, i) = K_eff \ F_eff;
% Calculate acceleration and velocity for the next step
A(:, i) = 1 / (beta * dt^2) * (U(:, i) - U(:, i-1)) - 1 / (beta * dt) *
V(:, i-1) - (0.5 / beta - 1) * A(:, i-1);
V(:, i) = V(:, i-1) + dt * ((1 - gamma) * A(:, i-1) + gamma * A(:, i));
end
end

You might also like