Matlab Vs Sap 2000
Matlab Vs Sap 2000
1
Validation Problem Ahmad Yasin
Contents
Contents .................................................................................................................................................. 2
Introduction ............................................................................................................................................. 3
SAP2000 ................................................................................................................................................. 6
MATLAB .............................................................................................................................................. 11
Script ................................................................................................................................................. 11
Reactions ........................................................................................................................................... 16
Conclusions ........................................................................................................................................... 18
2
Validation Problem Ahmad Yasin
Introduction
This aim of this document is to create a MATLAB script that calculates the nodal
displacements, reactions, and element forces for a multi-story multi-bays frame shown in
Figure 1.
Additionally, the same frame shall be modelled using SAP2000, computing the same
quantities. The last step is to compare the results with those obtained from the MATLAB script
and justify/explain the differences (if any).
Numbering for nodes and elements are unified in both MATLAB code and SAP2000 model
and shown in Figure 2. Loading conditions and dimensions are shown in Figure 3. Main
material characteristics and sections definitions are mentioned in Table 1.
3
Validation Problem Ahmad Yasin
Figure 2. 2D view for the frame showing the numbering of nodes and members
4
Validation Problem Ahmad Yasin
The following sections show the detailed calculations for SAP2000 and MATLAB.
SAP section is divided into sub-sections for material and sections definitions, and geometry
and loading. MATLAB section is divided into two sub-sections for input script and output
results. Then the third section is for comparison between the two approaches with conclusions.
5
Validation Problem Ahmad Yasin
SAP2000
6
Validation Problem Ahmad Yasin
7
Validation Problem Ahmad Yasin
8
Validation Problem Ahmad Yasin
9
Validation Problem Ahmad Yasin
10
Validation Problem Ahmad Yasin
MATLAB
Script
%% Project - Computational Structural Analysis
close all; clear; clc;
% Input data
E = 30e6; % Elastic modulus (psi)
Area_Beam = 40; % Cross-sectional area of Beams (in^2)
Area_Column = 46; % Cross-sectional area of Columns (in^2)
I_Beam = 960; % Moment of inertia of Beams (in^4)
I_Column = 1440; % Moment of inertia of Columns (in^4)
w1 = 25; % Uniform Load 1 = 0.3Kips/ft = 25 lbs/in
w2 = 37.5; % Triangular Load = 0.45 Kips/ft = 37.5 lbs/in
L = [192,192,192,192,192,192,192,192,120,144,144,120,144,144];
I = [repmat(I_Column,1,8), repmat(I_Beam,1,6)];
A = [repmat(Area_Column,1,8), repmat(Area_Beam,1,6)];
Th = [90,90,90,90,90,90,90,90,0,0,0,0,0,0];
Nnodes = 13;
DOFs_node = 3; % DOFs per node
DOFs = Nnodes * DOFs_node;
w = zeros(1, Number_Elements);
w(1,[9,10,12,13,14]) = w1;
w(1,11) = w2;
11
Validation Problem Ahmad Yasin
F(nodes(1,1)*DOFs_node) = F(nodes(1,1)*DOFs_node)-w(n)*(L(n))^2/12;
F(nodes(1,2)*DOFs_node) = F(nodes(1,2)*DOFs_node)+w(n)*(L(n))^2/12;
elseif n == 11 % Triangular load case
F(nodes*DOFs_node-1) = F(nodes*DOFs_node-1) -w(n)*L(n)/4;
F(nodes(1,1)*DOFs_node) = F(nodes(1,1)*DOFs_node)-5*w(n)*(L(n))^2/96;
F(nodes(1,2)*DOFs_node) = F(nodes(1,2)*DOFs_node)+5*w(n)*(L(n))^2/96;
end
end
12
Validation Problem Ahmad Yasin
13
Validation Problem Ahmad Yasin
% Transformation matrix
T = [ c_i, s_i, 0, 0, 0, 0;
-s_i, c_i, 0, 0, 0, 0;
0, 0, 1, 0, 0, 0;
0, 0, 0, c_i, s_i, 0;
0, 0, 0, -s_i, c_i, 0;
0, 0, 0, 0, 0, 1];
F_fixed_end = [0;
-w2*L_i/4;
-5*w2*L_i^2/96;
0;
-w2*L_i/4;
5*w2*L_i^2/96];
end
d_local = T * d_element;
14
Validation Problem Ahmad Yasin
% Display Results
fprintf('\n=== NODAL DISPLACEMENTS ===\n');
for i = 1:Nnodes
fprintf('\nNode %d:\n', i);
fprintf('X-displacement: %.6f inches\n', d((i-1)*3 + 1));
fprintf('Y-displacement: %.6f inches\n', d((i-1)*3 + 2));
fprintf('Rotation: %.6f radians\n', d((i-1)*3 + 3));
end
15
Validation Problem Ahmad Yasin
Global Displacements
Table 2. Global displacements in MATLAB and SAP2000
MATLAB SAP2000
Nodes
Ux(in) Uy(in) Rotation (rad) Ux(in) Uy(in) Rotation (rad)
1 0 0 0 0 0 0
2 0.004914 -0.0002 -4.67x10-5 0.004914 -0.0002 -4.7x10-5
3 0.018414 -0.00032 -5.75x10-5 0.018414 -0.000324 -5.8x10-5
4 0 0 0 0 0 0
5 0.004891 -0.00089 -2.66x10-5 0.004891 -0.000889 -2.7x10-5
6 0.01844 -0.001327 -1.87x10-5 0.01844 -0.00133 -1.9x10-5
7 0 0 0 0 0 0
8 0.004804 -0.00161 -7.89x10-5 0.004804 -0.001605 -7.9x10-5
9 0.018551 -0.00243 -0.0001 0.018551 -0.002433 -0.000101
10 0 0 0 0 0 0
11 -0.01974 -0.0306 -0.00013 -0.01974 -0.030602 -0.000127
12 0.004723 -0.03061 -0.00013 0.004723 -0.030606 -0.000127
13 0.018632 -0.03065 -0.00011 0.018632 -0.030651 -0.000113
Reactions
Table 3. Reaction forces in MATLAB and SAP2000
MATLAB SAP2000
Nodes
Rx(lb) Ry(lb) M(lb.in) Rx(lb) Ry(lb) M(lb.in)
1 -31.386 1541.9 13525 -31.39 1541.9 13525.2
4 -171.56 6391.6 22444 -171.56 6391.55 22443.96
7 202.95 1153.6 -17294 202.95 11535.94 -1729.42
10 0 30.6 0 0 30.6 0
16
Validation Problem Ahmad Yasin
Internal Forces
Note: Sign convention of SAP2000 software is different, so, data in this table is modified to match
with MATLAB sign conventions
17
Validation Problem Ahmad Yasin
Conclusions
Results shown in the comparison section show an exact matching between SAP2000 and
MATLAB results in terms of displacements, internal forces, and reactions. This is reasonable
since SAP2000 builds its analysis equations based on same criterion used in MATLAB
(Direct Stiffness Matrix).
18