You are on page 1of 3

2.

By Newmark Beta Method


%Define Stiffness Matrix
k=[8134, -4019, 0;-4019,10963, -6944; 0, -6944, 6944];
%define mass matrix
m=[3860, 0, 0; 0 1930, 0; 0, 0, 1930]/386;
%Eigen Value Analysis
[phi,wn]=eig(k,m);
%Classical Damping Matrix
zita=.05;
a0= 12.88;
a1= 0.000093;
c=a0*m+a1*k;
%Steady-State Response
F=[1000; 2000; 1500];
P=phi'*F;
K=phi'*k*phi;
M=phi'*m*phi;
t=0:0.1:10;
bita=1./wn;
sai=atan((2*zita.*bita)./(1-bita.^2));
D=((1-bita.^2).^2+(2*zita.*bita).^2).^.5;
q1=(P(1)/K(1,1))*sin(t-sai(1,1))/D(1,1);
q2=(P(2)/K(2,2))*sin(t-sai(2,2))/D(2,2);
q3=(P(3)/K(3,3))*sin(t-sai(3,3))/D(3,3);
u=phi(:,1)*q1+phi(:,2)*q2+phi(:,3)*q3;

%Newmark's Beta Method


R=F*sin(t);
x0=[0 0 0];
xdot0=[0 0 0];
[x, xdot, x2dot] = modifiednewmarkint(m, c, k, R, x0, xdot0,t);
%plot
subplot(3,1,1);
plot(t,u(1,:));
hold on
plot(t,x(1,:));
title('Displacement VS Time Graph')
xlabel('Time (sec)'), ylabel('Displacement, u1 (in)')
grid
subplot(3,1,2);
plot(t,u(2,:));
hold on
plot(t,x(2,:));
title('Displacement VS Time Graph')
xlabel('Time (sec)'), ylabel('Displacement, u2 (in)')
grid
subplot(3,1,3);
plot(t,u(3,:));
hold on
plot(t,x(3,:));
title('Displacement VS Time Graph')
xlabel('Time (sec)'), ylabel('Displacement, u3 (in)')
grid
legend('Modal Superpostion Method', 'Newmarks Beta Method')

function [x, xdot, x2dot] = modifiednewmarkint(M, C, K, R, x0, xdot0, ...


t, varargin)
%Newmark's Direct Integration Method
%--------------------------------------------------------------------------
% Code written by : - Siva Srinivas Kolukula |
% Senior Research Fellow |
% Structural Mechanics Laboratory |
% Indira Gandhi Center for Atomic Research |
% INDIA
% - HamedNokhostin |
% B.S. Student |
% Mechanical Engineering Faculty |
% K.N.ToosiUiversity of Technoloygy |
% I.R.Iran |
% E-mail : allwayzitzme@gmail.com
% h_nokhostin@yahoo.com |
%-------------------------------------------------------------------------
% PURPOSE
% ???
% SYNTAX
% [x, xdot, x2dot] = newmarkint(M, C, K, R, x0, xdot0, t, varargin)
% INPUT
% [M] : System Mass [n,n]
% [C] : System Damping [n,n]
% [K] : System Stiffness [n,n]
% [R] : Externally Applied Load [n,nt]
% [x0] : Initial Position [n,1]
% [xdot0] : Initial Velocity [n,1]
% [t] : Time Vector [1,nt]
% [varargin]: Options
%
% OUTPUT
% [x]: Displacemente Response [n,nt]
% [xdot]: Velocity [n,nt]
% [x2dot]: Acceleration [n,nt]
%
%
% nt = number of time steps
% n = number of nodes
% The options include changing the value of the "gamma" and "beta"
% coefficient which appear in the formulation of the method. By default
% these values are set to gamma = 1/2 and beta = 1/4.
%
% EXAMPLE
% To change nemark's coefficients, say to gamma = 1/3 and beta = 1/5,
% the syntax is:
% [u, udot, u2dot] = newmark_int(t,p,u0,udot0,m,k,xi, 1/3, 1/5)
%
%-------------------------------------------------------------------------
ifnargin == 7
disp('Using default values:');
disp(' gamma = 1/2');
disp(' beta = 1/4');
gamma = 1 / 2;
beta = 1 / 4;
elseifnargin == 9
gamma = varargin{1};
beta = varargin{2};
disp('Using user''s values:');
disp([' gamma = ', num2str(alpha)]);
disp([' beta = ', num2str(delta)]);
else
error('Incorrect number of imput arguments');
end
dt = t(2) - t(1);
nt = fix((t(length(t) )- t(1)) / dt);
n = length(M);
% Constants used in Newmark's integration
a1 = gamma / (beta * dt);
a2 = 1 / (beta * dt ^ 2);
a3 = 1 / (beta * dt);
a4 = gamma / beta;
a5 = 1/(2 * beta);
a6 = (gamma / (2 * beta) - 1) * dt;
x = zeros(n,nt);
xdot = zeros(n,nt);
x2dot = zeros(n,nt);
% Initial Conditions
x(:, 1) = x0;
xdot(:, 1) = xdot0;
%R0 = zeros(n,1);
x2dot(:,1) = M \ (R(:, 1) - C * xdot(:, 1) - K * x(:, 1)) ;
Kcap = K + a1 * C + a2 * M;
a = a3 * M + a4 * C;
b = a5 * M + a6 * C;
% Tme step starts
dR = diff(R')';
fori = 1 :nt
delR = dR(:,i) + a * xdot(:, i) + b * x2dot(:, i);
delx = Kcap \ delR ;
delxdot = a1 * delx - a4 * xdot(:,i) - a6 * x2dot(:, i);
delx2dot = a2 * delx - a3 * xdot(:,i) - a5 * x2dot(:, i);
x(:,i + 1) = x(:, i) + delx;
xdot(:,i + 1) = xdot(:, i) + delxdot;
x2dot(:,i + 1) = x2dot(:, i) + delx2dot;
end

You might also like