You are on page 1of 161

1

1. Lab-1

2. RISA 2D

1.1 Introduction
The educational version of the software RISA-2D, developed by RISA Technologies for the textbook
Fundamentals of Structural Analysis, is an interactive computer program for the analysis of two-
dimensional structures such as continuous beams, trusses, and frames. This program has been developed
to make the definition, solution and modification of 2-dimensional problem data as fast and easy as
possible. RISA-2D Educational has full graphical modeling capability allowing you to draw and edit
your model on the screen. The analysis results can also be displayed graphically. A help file is also
provided for a more detailed description of the program features. The numbers of joints and members
are respectively limited to 50 in this educational version.

1.2 Principle of working


The program solution is based on the widely accepted linear elastic direct stiffness method. First, the
stiffness of each element of the structure is calculated. These stiffnesses are then combined to produce
the model's global structure stiffness matrix. Next, the global matrix is solved for the applied loads to
calculate joint deflections that are then used to calculate the individual element forces and deflections.

1.3 Truss Analysis


The 2-dimensional truss to be analyzed is shown in Figure 1 -1. It is indeterminate to the first degree.
Assume the area of each member is 1.2 in2 and the Young’s modulus is 29,000 ksi. A step-by-step
analysis procedure is provided below.

Figure 1-1: 2-Dimensional Truss Example

1. Start the RISA-2D Educational program. Figure 2 shows that a manual bar will appear
at the top of the window. In addition to a Data Entry toolbar, a global XY coordinate
system and a set of grid lines in the Model View window will also appear.

Page 1 of 161
2

2.
Figure 1-2: Interface of RISA-2D
manual bar

3. If you have created an input file previously, click File from the manual bar and select
Open to open the input file. Otherwise, you can go to the next step to create a new
model.
4. Click Global from the manual bar and enter the information for Model Title and
Designer in the Global Parameters window (see Figure 3). The program can provide
internal forces (moment, shear, axial force) at a number of equally spaced sections
along a member. The default number of sections is 5, which is useful when you analyze
continuous beams or frames. For truss analysis, however, the only internal member
force is axial load, and the axial load is constant along a truss member. Set the Number
of Sections to 2 so that the internal forces at both ends of the member will be provided.
Click OK once you have completed the information.

Page 2 of 161
3

Figure 1-3: Global parameters

5. Click Units from the manual bar. One option you can choose in the Units Selection
window is Use CONSISTENT units. This is the method we usually use for hand
calculations. That is, all the physical quantities like length, section properties (A and I),
material properties (E), loads, reactions, member forces, and deformations are
expressed in terms of consistent units (e.g., kips and inches). For practical applications,
the program provides a more convenient way of handling unit conversions internally by
allowing the designer to choose either the Standard Imperial or Standard Metric units.
We choose Standard Imperial in this example. Clock OK once you have selected the
units.

Figure 1-4: Unit Selection

6. Click Modify from the manual bar and select Grid. A Define Drawing Grid window will
show that the program assigns, by default, (0, 0) as the coordinates for the origin (see

Page 3 of 161
4

Figure 5). Furthermore, the program assigns 30 grids with a unit length (1 ft) as the
increment in each direction (see Figure 2). Considering the overall dimensions of the
structure in Figure 1, we can change the default setting to 4@10 ft and 6@5 ft in the X
and Y directions, respectively, such that all joints will fall on the grid. Save the Grid
Settings and provide a description (e.g., Drawing Grid 1) for this drawing grid. If you
open an existing file, it is necessary to Retrieve this grid settings in order to show the
grids you previously defined. Click OK to complete this step. You will see the new
drawing grid (see Figure 11).

Figure 1-5: Grid System

7. The next step is to provide data for the structure. If the Data Entry toolbar in Figure 2
disappears for some reason, click Spreadsheet from the manual bar and select Data
Entry Buttons Toolbar to activate it (see Figure 6).

Page 4 of 161
5

Figure 1-6: Data Entry Bar

8. Click Joint Coordinates from the Data Entry toolbar to define each joint and its
coordinates. (Step 14 shows a more convenient way to specify joint coordinates
graphically.) Follow the instruction in the Joint Coordinates window to define each joint
(see Figure 7). The program by default labels each joint sequentially as N1, N2, . . ., etc.
But you can rename each joint, as long as the joint name does not start with a number
(e.g., 1N). Click Edit from the manual bar or right click the mouse and select Insert
Line to add additional joints. Upon completing the joint data, you can click View from
the manual bar and select Joint Labels to check the joint input graphically (see Figure
11).

Figure 1-7: Joint Coordinates

9. Click Boundary Conditions from the Data Entry toolbar to specify the support
condition. For this example, joint A is supported by a vertical roller. Click the field for
X for a red arrow. Clicking on the arrow will allow you to define whether that direction
is free to move, fixed, or supported by a spring. We specify joint A as Fixed because it
cannot move in the horizontal (or X) direction. Click Edit from the manual bar and
select Insert Line to add another two entries for the support condition for joints C and E
(see Figure 8). Clicking View from the manual bar and selecting , the program will
show graphically the boundary condition of the structure (see Figure 11). A horizontal
green line at joint A means that the joint cannot move in the horizontal direction.

Page 5 of 161
6

Figure 1-8: Boundary Conditions

10. Member information is provided in this step. A total of 7 truss members exist in the
structure. Click Members in the Data Entry toolbar to specify member data, which
include the member label, joint labels at both ends (I for near joint and J for far
joint), area, and Young’s modulus (see Figure 9). You can ignore the field of moment
of inertia by using the default value because it is not needed for truss analysis. The
length of each member will be computed by the computer program automatically. Since
members in a truss are pin-connected at both ends, it is necessary to “release” the
moment at both ends of the member (that is, zero moment at member ends). This can be
achieved by clicking the field of I Release (and J Release). Clicking on the red arrow
will then bring up the Set Member Release Codes window (see Figure 9), from which
you can specify that both ends are Pinned. In the Model View window, the program will
insert an open circle near the member end to indicate that moment has been released
(see Figure 11). Also see Step 14 for graphic input of members.

Page 6 of 161
7

Figure 1-9: Members

11. Joint loads are specified in this step. Only a 9-kip vertical load is applied at joint B.
Click Joint Loads from the Data Entry toolbar. Specify the joint label in the first column
of the Joint Loads and Enforced Displacements spreadsheet (see Figure 10). Specify L
(Load) in the second column. The direction of load, which is in the Y direction for
vertical load, is specified in the third column. The magnitude of the vertical load is
specified in the fourth column. Because the vertical load acts in the downward
direction, which is in the negative Y direction, the magnitude of the joint load is –9.
[You can specify D (Displacement) in the second column for problems that involve
support settlements.] Also see Step 14 for graphic input of loads.

Figure 1-10: Joint Loads and Displacements

12. The last two entries (Point Loads and Distributed Loads) in the Data Entry toolbar are
used to specify loads that act on a member. These two entries are not needed in this
example because the truss, by definition, can only carry joint loads. The data entry is
now complete. You can check the geometry, the boundary condition, as well as the
labels of joints and members graphically by clicking View from the manual bar. From
the View drop-down manual, you can select whatever information including the applied
load for display (see Figure 11).

Page 7 of 161
8

Figure 1-11: Model View

13. Now click Solve (or click the icon) from the manual bar. The program will perform
the structural analysis. A Results toolbar will appear if the analysis is successful (see
Figure 12). (Clicking Results from the manual bar and select Results Button Toolbar can
also activate this toolbar.) If the data entry is incomplete or the structure is unstable, the
program will issue an error message. A Joint Reactions spreadsheet summarizing all the
reaction forces will also appear in the window. The last row represents the summation
of all reaction forces in the X and Y directions, respectively, which can be used to
check global equilibrium. Figure 12 shows that the sum of horizontal reactions is equal
to zero. In the vertical direction, the summation of the vertical reaction forces (9 kips) is
also in equilibrium with the downward external load (-9 kips).

Page 8 of 161
9

Figure 1-12: Model View and Results

14. The joint deflection information can be viewed by clicking Joint Deflections from the
Results toolbar (see Figure 13). Clicking Member Forces from the Results toolbar gives
a summary of internal forces in all members (see Figure 14). These are the member
forces calculated along each member. The number of sections for which forces are
reported is controlled by the Number of Sections specified in the Global Parameter
window (see Figure 3). The number of member segments is the Number of Sections
minus 1. The length of each segment is the same. For example, if you specify 5
sections, the member is divided into 4 equal pieces, and the forces are reported for each
piece (see Figure 15). As for the sign convention, the signs of these results correspond
to the member's local axes, using the right hand rule. The left side forces at each section
location are displayed. There are three force values for each section location. These are
axial, shear and moment. As can be seen in Figure 15, the section forces listed at any
given section are the left side forces. For axial forces, compressive is positive. For
moments, counter-clockwise around the member axis is positive.

Page 9 of 161
10

Figure 1-13: Joint Deflection

Figure 1-14: Member Forces

Page 10 of 161
11

15. Note that creating the model and specifying loading as described in step (6) through
step (11) can also be performed graphically. Figure 16 shows the icons that
can be used for this purpose. For example, clicking the third icon ( ) allows
you to specify both the joints and members. The support conditions can be
specified by and the loadings can be specified by clicking ( ) either one of

graphic input icons

Figure 1-15: Graphic input Tool Bars

Page 11 of 161
Lab -2
Develop the following Truss models in RISA 2D and Evaluate the member forces, Reactions and
deflection.

Task-1:

Task-2

Page 12 of 161
Task-3

Task-4

Task-5

Page 13 of 161
Lab-3
1.4 Beam & Frame Analysis
Consider the 2-dimensional frame in Figure 17. It is indeterminate to the sixth degree. Assuming
that the value of I is 500 in4, the area of member AB is 15 in2, the area of the remaining members is
10 in2, and a Young’s modulus of 29,000 ksi, the analysis is summarized below.

Figure 1-16: 2-D Frame Example

1. Follow Steps 1 through 4 in the previous section to provide general information. In


step 3, use the default value for the Number of Sections so that internal forces at 5
equally spaced locations along each member will be provided. The frame is composed
of 6 joints and 5 members. In step 5, change the default grid settings to 40@1 ft and
19@1 ft in the X and Y directions, respectively, such that all joints of the frame fall
on the grid.
2. Follow Step 7 to enter the joint coordinates (see Figure 18). Alternatively, you can
follow Step 14 to specify both joints and members graphically.

Figure 1-17: Joint Coordinates for Frame

3. Follow Step 8 to provide information for the Boundary Conditions. Since joints E
and F are fix-ended, set the boundary codes for all the directions (X, Y, and rotation)
as Fixed (see Figure 19).

Page 14 of 161
Figure 1-18: Boundary Condition

4. Click Members in the Data Entry toolbar to specify member data, which include the
member labels, joint labels at both ends, area, moment of inertia, and Young’s
modulus (see Figure 20). Note that shearing deformation of the member is ignored in
this educational version. If it is desired to ignore the axial deformation of the flexural
member, you can specify a large value for the member area.

Figure 1-19: Members

5. Skip Joint Loads from the Data Entry toolbar because this example does not have
joint loads. Instead, click Point Loads from the Data Entry toolbar to specify the
32-kip point load that acts on member BC (see Figure 21). Click Distributed
Loads from the Data Entry toolbar to specify the uniformly distributed load that
acts on member AB (see Figure 22). The data entry is now complete. Click View
from the manual bar and select Loads to show graphically the applied loads (Figure
23)

Page 15 of 161
Note that you can select the loading direction as X, Y, x, or y in the Direction field when specifying
either the point load or the distributed load. Directions X and Y refer to the global coordinate system
(see Figure 2), while directions x and y refer to the local coordinate system of a member. As can be
seen from Figure 24, the local x-axis corresponds to the member centerline. The positive direction of
this local x- axis is from I joint towards J joint. The local z-axis is always normal to the plane of the
model with positive z being towards you. The local y-axis is then defined by the right-hand rule.
When a member is inclined, it is sometimes more convenient to specify the point load or transverse
load in the local coordinate system.

Figure 1-20: Point Loads

Figure 1-21: Distributed Loads

Figure 1-22: 2D Complete Model

Page 16 of 161
Figure 1-23: Local and Global Coordinates

6. Now click Solve from the manual bar to perform the structural analysis. Click Joint
Reactions from the Results toolbar to view the reaction forces (see Figure 25). Click
Joint Deflections for the deflections and rotation at each joint (see Figure 26). Click
Member Deflections if you are interested in the deflections of the members (see
Figure 27). The member internal forces at equally spaced sections along each member
can be viewed by clicking Member Forces (see Figure 28). The sign convention of
the internal forces is defined in Figure 15.

Figure 1-24: Frame Joint Recations

Figure 1-25: Joint Deflection

Page 17 of 161
Figure 1-26: Member deflections

Figure 1-27: Member Section Forces

7. Analysis results can also be viewed graphically in the Model View window by
clicking on the icons below the manual bar (see Figure 29). (If this window does not
appear, click View from the manual bar and select New View to create one.) For

Page 18 of 161
example, Figure 30 shows the moment diagrams, reactions, and the deflected shape of
the structure. Figure 31 depicts the reactions together with the applied loads.

Figure 1-28: Result Shortcuts

Figure 1-29: Graphical Representation of SFD and Deflection

Page 19 of 161
Figure 1-30: Graphical Representation of Reactions

Page 20 of 161
Develop the SFD and BMD of the following beams and find the reactions using RISA-2D

Task-1: A and B are the Roller Support and C is the Pin Support

Task-2: B, D and F are the Roller Support and A is the Pin Support, whereas C and E are the pin
connection

Task-3: A is the Pin Support and B is the roller support

Task-4: A is the roller support; B is the Fixed Support and C is the pin connection

Task-5: A is the roller support; B is the Fixed Support and C is the pin connection

Page 21 of 161
Page 22 of 161
Lab-4
Develop the SFD and BMD of the following Frames and find the reactions using RISA-2D

Task-1: A and B are the Pin Support and C is the Pin connection

Task-2: A, C are the Pin Support, whereas B is the pin connection

Task-3: A and C is the Pin Support and B is the Pin connection

Page 23 of 161
Task-4: C is the Fix support; C is the roller support.

Task-5: A and D, are the Pin support; B is the pin connection

Page 24 of 161
Page 25 of 161
Lab-5
2. MATLAB

2.1 Introduction
The name MATLAB stands for MATrix LABoratory. MATLAB was written originally to provide easy
access to matrix software developed by the LINPACK (linear system package) and EISPACK (Eigen
system package) projects.

MATLAB is a high-performance language for technical computing. It integrates computation,


visualization, and programming environment. Furthermore, MATLAB is a modern programming
language environment: it has sophisticated data structures, contains built-in editing and debugging
tools, and supports object-oriented programming. These factors make MATLAB an excellent tool for
teaching and research.

2.2 Starting MATLAB


After logging into your account, you can enter MATLAB by double-clicking on the MATLAB shortcut
icon (MATLAB 7.0.4) on your Windows desktop. When you start MATLAB, a special window called
the MATLAB desktop appears. The desktop is a window that contains other windows. The major
tools within or accessible from the desktop are:

 The Command Window


 The Command History
 The Workspace
 The Current Directory
 The Help Browser
 The Start button
When MATLAB is started for the First time, the screen looks like the one that shown in the Figure
1.1. This illustration also shows the default configuration of the MATLAB desktop. You can customize
the arrangement of tools and documents to suit your needs.

Page 26 of 161
Figure 2-31: The graphical interface to the MATLAB workspace

2.3 Using MATLAB as a calculator


As an example of a simple interactive calculation, just type the expression you want to evaluate.
Let's start at the very beginning. For example, let's suppose you want to calculate the expression, 1 +
2 x 3. You type it at the prompt command (>>) as follows,




You will have noticed that if you do not specify an output variable, MATLAB uses a default variable
ans, short for answer, to store the results of the current calculation. Note that the variable ans is
created (or overwritten, if it is already existed). To avoid this, you may assign a value to a variable or
output argument name. For example,

>> x = 1+2*3
x=

Page 27 of 161
7

2.4 Overwriting variable


Once a variable has been created, it can be reassigned. In addition, if you do not wish to see the
intermediate results, you can suppress the numerical output by putting a semicolon (;) at the end of
the line. Then the sequence of commands looks like this:

>> t = 5;
>> t = t+1
t=
6

2.5 Error messages


If we enter an expression incorrectly, MATLAB will return an error message. For example, in the
following, we left out the multiplication sign, *, in the following expression

>> x = 10;
>> 5x
??? 5x
|
Error: Unexpected MATLAB expression.

2.6 Getting help


To view the online documentation, select MATLAB Help from Help menu or MATLAB Help directly in
the Command Window. The preferred method is to use the Help Browser. The Help Browser can be
started by selecting the? icon from the desktop toolbar. On the other hand, information about any
command is available by typing

>> help Command

2.7 Mathematical functions


MATLAB offers many predefined mathematical functions for technical computing which contains a
large set of mathematical functions.

Table 2-1: Elementary functions


cos(x) Cosine sqrt(x) Square root
sin(x) Sine max(x) Maximum value
tan(x) Tangent min(x) Minimum value
abs(x) Absolute value log(x) Natural logarithm

Page 28 of 161
In addition to the elementary functions, MATLAB includes a number of predefined constant values.
A list of the most common values is given in Table 2 -2.

Table 2-2: Predefined constant values


Pi The π number, π = 3.14159…
i,j The imaginary unit i=√ −1,
Inf The infinity, ∞
NaN Not a number

2.7.1 Examples

y=e−a sin ( x ) +10 √ y for a=5 , x=2∧ y=8

>> a = 5; x = 2; y = 8;
>> y = exp(-a)*sin(x)+10*sqrt(y)
y=
28.2904

The subsequent examples are

>> log(142)
ans =
4.9558
>> log10(142)
ans =
2.1523

2.8 Basic plotting

>> x = [1 2 3 4 5 6];
>> y = [3 -1 2 4 5 1];
>> plot(x,y)

Page 29 of 161
Figure 2-32: Plot for the vectors x and y

>> x = 0:pi/100:2*pi;
>> y = sin(x);
>> plot(x,y)

2.9 Adding titles, axis labels, and annotations


MATLAB enables you to add axis labels and titles. For example, using the graph from the previous
example, add an x- and y-axis labels.

Now label the axes and add a title. The character \pi creates the symbol π. An example of 2D plot is
shown in Figure 2.2.

Page 30 of 161
Figure 2-33: Plot of the Sine function

>> xlabel('x = 0:2\pi')


>> ylabel('Sine of x')
>> title('Plot of the Sine function')

The color of a single curve is, by default, blue, but other colors are possible. The desired color is
indicated by a third argument. For example, red is selected by plot(x,y,'r'). Note the single quotes, ' ',
around r.

2.10 Multiple data sets in one plot


Multiple (x; y) pairs arguments create multiple graphs with a single call to plot. For example, these
statements plot three related functions of x: y 1 = 2 cos(x), y2 = cos(x), and y3 = 0.5 * cos(x), in the
interval 0 ≤ x ≤ 2π.

>> x = 0:pi/100:2*pi;
>> y1 = 2*cos(x);
>> y2 = cos(x);
>> y3 = 0.5*cos(x);
>> plot (x,y1,'--',x,y2,'-',x,y3,':')
>> xlabel ('0 \leq x \leq 2\pi')
>> ylabel ('Cosine functions')
>> legend ('2*cos(x)','cos(x)','0.5*cos(x)')
>> title('Typical example of multiple plots')
>> axis([0 2*pi -3 3])

2.11 Entering a vector

>> v = [1 4 7 10 13]
v = 1 4 7 10 13
>> w = [1;4;7;10;13]
w=
1
4
7
10
13

Page 31 of 161
>> w = v'
w=
1
4
7
10
13

Thus, v(1) is the first element of vector v, v(2) its second element, and so forth. Furthermore, to
access blocks of elements, we use MATLAB's colon notation (:). For example, to access the first three
elements of v, we write

>> v(1:3)
ans =
147

Or, all elements from the third through the last elements,

>> v(3,end)
ans =
7 10 13

where end signiFies the last element in the vector. If v is a vector, writing

>> v(:)

produces a column vector, whereas writing

>> v(1:end)

produces a row vector.

2.12 Entering a matrix


A matrix is an array of numbers. To type a matrix into MATLAB you must

 begin with a square bracket, [


 separate elements in a row with spaces or commas (,)
 use a semicolon (;) to separate rows
 end the matrix with another square bracket, ].

Here is a typical example. To enter a matrix A, such as,

Page 32 of 161
1 2 3

[ ]
A= 4 5 6
7 8 9

type,

>> A = [1 2 3; 4 5 6; 7 8 9]

Note that the use of semicolons (;) here is different from their use mentioned earlier to suppress
output or to write multiple commands in a single line.

Once we have entered the matrix, it is automatically stored and remembered in the Workspace. We
can refer to it simply as matrix A. We can then view a particular element in a matrix by specifying its
location. We write,

>> A(2,1)
ans =
4

A(2,1) is an element located in the second row and first column. Its value is 4.

2.13 Matrix indexing


We select elements in a matrix just as we did for vectors, but now we need two indices. The element
of row i and column j of the matrix A is denoted by A(i,j). Thus, A(i,j) in MATLAB refers to the
element Aij of matrix A. The first index is the row number and the second index is the column
number. For example, A(1,3) is an element of first row and third column. Here, A(1,3)=3.

Correcting any entry is easy through indexing. Here we substitute A(3,3)=9 by A(3,3)=0. The result is

>> A(3,3) = 0
A=
123
456
780

2.14 Dimension
To determine the dimensions of a matrix or vector, use the command size. For example,

>> size(A)
ans =
33

Page 33 of 161
2.15 Solving linear equations
A-1=

Exercise
Task:

Task:

Task:

Task:
Task:
Task:

Task:

Task:

Task:

Task:

Page 34 of 161
Task:

Task

Page 35 of 161
Lab-6
2.16 Control Flow and operators
MATLAB is also a programming language. Like other computer programming languages, MATLAB has
some decision-making structures for control of command execution. These decisions making or
control Flow structures include for loops, while loops, and if-else-end constructions. Control Flow
structures are often used in script M-Files and function M-Files. By creating a File with the
extension .m, we can easily write and run programs. We do not need to compile the program since
MATLAB is an interpretative (not compiled) language. MATLAB has thousands of functions, and you
can add your own using m-Files. MATLAB provides several tools that can be used to control the Flow
of a program (script or function). In a simple program as shown in the previous Chapter, the
commands are executed one after the other. Here we introduce the Flow control structure that
make possible to skip commands or to execute specific group of commands.

2.17 Control Flow


MATLAB has four control flow structures: the if statement, the for loop, the while loop, and the
switch statement.

2.17.1 The ``if...end'' structure


MATLAB supports the variants of \if" construct.

if ... end
if ... else ... end
if ... elseif ... else ... end

The simplest form of the if statement is

if expression
statements
end

Here are some examples based on the familiar quadratic formula.

1. discr = b*b - 4*a*c;


if discr < 0
disp('Warning: discriminant is negative, roots are imaginary');
end
2. discr = b*b - 4*a*c;
if discr < 0
disp('Warning: discriminant is negative, roots are imaginary');
else

Page 36 of 161
disp('Roots are real, but may be repeated')
end
3. discr = b*b - 4*a*c;
if discr < 0
disp('Warning: discriminant is negative, roots are imaginary');
elseif discr == 0
disp('Discriminant is zero, roots are repeated')
else
disp('Roots are real')
end

It should be noted that:

 elseif has no space between else and if (one word)


 no semicolon (;) is needed at the end of lines containing if, else, end
 indentation of if block is not required, but facilitate the reading.
 the end statement is required

2.17.2 Relational and logical operators


A relational operator compares two numbers by determining whether a comparison is true or false.
Relational operators are shown in Table 5.1.

Table 2-3: Relational and logical operators


Operator Description

Note that the \equal to" relational operator consists of two equal signs (==) (with no space between
them), since = is reserved for the assignment operator.

2.17.3 The ``for...end'' loop


In the for ... end loop, the execution of a command is repeated at a Fixed and predeter-

mined number of times. The syntax is

Page 37 of 161
for variable = expression
statements
end

Usually, expression is a vector of the form i : s : j. A simple example of for loop is

for ii=1:5
x=ii*ii
end

It is a good idea to indent the loops for readability, especially when they are nested. Note that
MATLAB editor does it automatically.

Multiple for loops can be nested, in which case indentation helps to improve the readability. The
following statements form the 5-by-5 symmetric matrix A with (i; j) element

i/j for j ≥ i:
n = 5; A = eye(n);
for j=2:n
for i=1:j-1
A(i,j)=i/j;
A(j,i)=i/j;
end
end

2.17.4 The ``while...end'' loop


This loop is used when the number of passes is not specified. The looping continues until a stated
condition is satisfied. The while loop has the form:

while expression
statements
end
The statements are executed as long as expression is true.

x=1
while x <= 10
x = 3*x
end

It is important to note that if the condition inside the looping is not well defined, the looping will
continue indefinitely. If this happens, we can stop the execution by pressing Ctrl-C.

Page 38 of 161
2.17.5 Other Flow structures

 The break statements. A while loop can be terminated with the break statement,
which passes control to the First statement after the corresponding end. The break
statement can also be used to exit a for loop.
 The continue statement can also be used to exit a for loop to pass immediately to the
next iteration of the loop, skipping the remaining statements in the loop.
 Other control statements include return, continue, switch, etc. For more detail about
these commands, consul MATLAB documentation.

2.17.6 Operator precedence


We can build expressions that use any combination of arithmetic, relational, and logical operators.
Precedence rules determine the order in which MATLAB evaluates an expression. We have already
seen this in the \Tutorial Lessons".

Here we add other operators in the list. The precedence rules for MATLAB are shown in this list
(Table 5.2), ordered from highest (1) to lowest (9) precedence level. Operators are evaluated from
left to right.

Table 2-4: Operator precedence


Precedence Operator

Page 39 of 161
2.17.7 Saving output to a file
In addition to displaying output on the screen, the command fprintf can be used for writing the
output to a File. The saved data can subsequently be used by MATLAB or other softwares.

To save the results of some computation to a File in a text format requires the following steps:

1. Open a File using fopen


2. Write the output using fprintf
3. Close the File using fclose

Here is an example (script) of its use.

% write some variable length strings to a file


op = fopen('weekdays.txt','wt');
fprintf(op,'Sunday\nMonday\nTuesday\nWednesday\n');
fprintf(op,'Thursday\nFriday\nSaturday\n');
fclose(op);

This File (weekdays.txt) can be opened with any program that can read .txt File.

Page 40 of 161
Exercise

Page 41 of 161
2.1.1 Lab-7
Develop the function for Elemental stiffness Metrix

1. Number all of the nodes and all of the elements.


2. Identify the Displacement Degrees of Freedom in Global Directions.
Number all the structural degrees of freedom in your truss. In a 2D (planar) truss,
each node can have a maximum of two degrees of freedom: one in the global X-
direction and one in the global Y -direction.
3. Node Locations.
Write the (x, y) coordinates of each node using units consistent with E and A. In other
words, if E and A are given in kN/cm2 and cm2, write the (x, y) coordinates in terms
of centimetres.
4. Define each element.
Draw each element of your truss individually and draw the local coordinates in the
global directions. For example, if element number N is a diagonal truss element, and
the global directions are X: horizontal and Y: vertical, draw element number N like
this:

where 1,2,3,4 are the element coordinates of the truss element in the global directions.
The local coordinates are always numbered 1,2,3,4 with 1 and 3 pointing in the global
X direction (to the right) and with 2 and 4 pointing in the global Y direction (up).
Some or all of these four coordinates will line up with the structural degrees of
freedom that you identified in step 2., above. The angle θ is the counter clockwise
angle from element coordinate 1 to the truss element.

Page 42 of 161
5. Element Stiffness Matrices in Global Coordinates, K.
Element Stiffness Matrices in Global Coordinates, K. For each element, find its (4x4)
element stiffness matrix, by evaluating the equations below:
2 2

L= ( x 2−x 1 ) −( y 2 − y 1 )

ls=( x2− x1 ) / L

lm= ( y 2− y 1 ) / L

ls2 lslm −ls2 −lslm


K=
EA lslm
[ lm2 −lslm −lm2
L −ls 2 −lslm
−lslm −lm 2
ls2
lslm
lslm
lm2
]
You should understand where these equations come from, why this matrix is symmetric, why
the diagonal terms are all positive, and what the off-diagonal terms mean.

Page 43 of 161
Lab–8
Develop the structural stiffness matrix of the previous diagram and write down the results.

1. Structural Stiffness Matrix, Ks.


The structural stiffness matrix is a square, symmetric matrix with dimension equal to
the number of degrees of freedom. In this step we will fill up the structural stiffness
matrix using terms from the element stiffness matrices in global coordinates. This
procedure is called matrix assembly.
The element degrees of freedom (1,2,3,4) line up with the structural degrees of
freedom in your problem. For example, coordinates (1,2,3,4) might line up with
degrees of freedom (3,4,7,8) of the truss. In this case, to assemble this element into
the structural stiffness matrix,

Page 44 of 161
Lab-9
Develop the program for the nodal displacement and reactions.
Once the structure stiffness matrix is formed, the global force components Q acting on the truss can
then be related to its global displacements D using
Q = KD
This equation is referred to as the structure stiffness equation. Since we have always assigned the
lowest code numbers to identify the unconstrained degrees of freedom, this will allow us now to
partition this equation in the following form*:
Qk K 11 ⋮ K 12 Du

[ ][

Qu
= ⋯ ⋯
K 21 ⋮
⋯ ⋯
K 22 Dk][ ]
Qk, Dk = Known external loads and displacements; the loads here exist on the truss as part of the
problem, and the displacements are generally specified as zero due to support constraints such as
pins or rollers.
QU, DU = Unknown loads and displacements; the loads here represent the unknown support
reactions, and the displacements are at joints where motion is unconstrained in a particular
direction.
K= Structure stiffness matrix, which is partitioned to be compatible with the partitioning of Q and D.
Q k =K 11 D u+ K 12 D k
Q u=K 21 D u + K 22 D k

Page 45 of 161
Lab-10
Develop the program for the development of displacement matrix and forces.
For Detail See (Structural Analysis) (RC Hibbler) Article 14.3 Page 543
In global coordinates each end of the member can have two
degrees of freedom or independent displacements; namely, joint N
has and Figure 2 -34a and Figure 2 -34b, and joint F has and Figure
2 -34c and Figure 2 -34d. We will now consider each of these
displacements separately, in order to determine its component
displacement along the member. When the far end is held pinned
and the near end is given a global displacement Figure 2 -34a, the
corresponding displacement (deformation) along the member is *
Likewise, a displacement will cause the member to be displaced
along the axis, Figure 2 -34b. The effect of both global
displacements causes the member to be displaced
d N =D Nx cos Dθ x + D Ny cos Dθ y
We will now combine the results of the preceding sections and
determine the stiffness matrix for a member which relates the
member’s global force components Q to its global displacements D
we can determine the member’s forces q in terms of the global
displacements D at its end points, namely,

Figure 2-34

Page 46 of 161
Lab-11
Represent the complete results (K, Reactions, member forces of the given truss)

E=29000Ksi A=0.75in2

Determine the force in members of the assembly in Figure below, if the support at joint ① settles
downward 25 mm. Take A=40mm2 E=200Gpa

Page 47 of 161
Lab-12
2.18 Develop the elemental Stiffness Matrix of a beam
Divide the beam into finite elements and arbitrarily identify each element and its nodes. Use a
number written in a circle for a node and a number written in a square for a member. Usually an
element extends between points of support, points of concentrated loads, and joints, or to points
where internal loadings or displacements are to be determined. Also, E and I for the elements must
be constants

Specify the near and far ends of each element symbolically by directing an arrow along the element,
with the head directed toward the far end.

At each nodal point specify numerically the y and z code numbers. In all cases use the lowest code
numbers to identify all the unconstrained degrees of freedom, followed by the remaining or highest
numbers to identify the degrees of freedom that are constrained.

2.19 Member and Node Identification.


In order to apply the stiffness method to beams, we must first determine how to subdivide the beam
into its component finite elements. In general, each element must be free from load and have a
prismatic cross section. For this reason the nodes of each element are located at a support or at
points where members are connected together, where an external force is applied, where the cross-
sectional area suddenly changes, or where the vertical or rotational displacement at a point is to be
determined. For example, consider the beam in Figure 2 -35. Using the same scheme as that for
trusses, four nodes are specified numerically within a circle, and the three elements are identified
numerically within a square. Also, notice that the “near” and “far” ends of each element are
identified by the arrows written alongside each element.

Figure 2-35

2.20 Global and Member Coordinates.


The global coordinate system will be identified using x, y, z axes that generally have their origin

at a node and are positioned so that the nodes at other points on the beam all have positive
coordinates, Figure 2 -35. The local or member x’, y’, z’ coordinates have their origin at the “near”
end of each element, and the positive x’ axis is directed towards the “far” end. Figure 2 -36 shows
these coordinates for element 2.

Page 48 of 161
Figure 2-36
In both cases we have used a right-handed coordinate system, so that if the fingers of the right hand
are curled from the x(x’) axis towards the y(y’) axis, the thumb points in the positive direction of the
z(z’) axis, which is directed out of the page. Notice that for each beam element the x and axes will be
collinear, and the global and member coordinates will all be parallel. Therefore, unlike the case for
trusses, here we will not need to develop transformation matrices between these coordinate
systems.

2.21 Beam Member Stiffness Metrix


In this section we will develop the stiffness matrix for a beam element or member having a constant
cross-sectional area and referenced from the local x’, y’, z’ coordinate system, Figure 2 -37. The
origin of the coordinates is placed at the “near” end N, and the positive x’ axis extends toward the
“far” end F. There are two reactions at each end of the element, consisting of shear forces q Ny’ and
qFy bending moments qNz’ and qFz’ These loadings all act in the positive coordinate directions. In
particular, the moments qNz’ and qFz’ are positive counter clockwise, since by the right-hand rule the
moment vectors are then directed along the positive z’axis, which is out of the page. Linear and
angular displacements associated with these loadings also follow this same positive sign convention.
We will now impose each of these displacements separately and then determine the loadings acting

Figure 2-37

2.22 y’ Displacements.
When a positive displacement dNy’ is imposed while other possible displacements are prevented, the
resulting shear forces and bending moments that are created are shown in Figure 2 -38a. In
particular, the moment has been developed in Sec. 11–2 as Eq. 11–5 of Structural Analysis by RC
Hibbler. Likewise, when dFy’ is imposed, the required shear forces and bending moments are given in
Figure 2 -38b.

Page 49 of 161
Figure 2-38

2.23 Z’ Rotations.
If a positive rotation dNZ’ is imposed while all other possible displacements are prevented, the
required shear forces and moments necessary for the deformation are shown in Figure 2 -39a. In
particular, the moment results have been developed in Sec. 11–2 as Eqs. 11–1 and 11–2. Of
Structural Analysis by RC Hibbler. Likewise, when d Fz’ is imposed, the resultant loadings are shown in
Figure 2 -39b.

Figure 2-39
By superposition, if the above results in Figure 2 -38 and Figure 2 -39 are added, the resulting four
load-displacement relations for the member can be expressed in matrix form as

12 6 −12 6

[ ]
L3 L2 L3 L2
q Ny ' 6 4 −6 2 d Ny '

[]
q Nz '
q Fy '
qFz '
=EI
L2
−12
L3
6
L
−6
L2
2
L2
12
L3
−6
L
−6
L2
4
[]
d Nz '
d Fy '
d Fz '

L2 L L2 L

These equations can also be written in abbreviated form as

q=kD
The symmetric matrix k in above Equation. is referred to as the member stiffness matrix. The 16
influence coefficients kij that comprise it account for the shear-force and bending-moment

Page 50 of 161
displacements of the member. Physically these coefficients represent the load on the member when
the member undergoes a specified unit displacement.

Now Write a program for Elemental stiffness matrix of the beam

L=x 2−x 1

12/ L3 6 /L2 −12/L3 6/ L2


K= EI
[6/ L2
3
4/ L
−12/ L −6 /L
6/ L2 2/ L
2
−6/ L2
12/L 3

−6/ L2
2 /L
−6/ L2
4/L
]

Page 51 of 161
Lab-12
Develop the structural stiffness matrix of the previous diagram and write down the results.

1. Consider all the previous method for the development of elemental stiffness matrix
2. Structural Stiffness Matrix, Ks.
The structural stiffness matrix is a square, symmetric matrix with dimension equal to
the number of degrees of freedom. In this step we will fill up the structural stiffness
matrix using terms from the element stiffness matrices in global coordinates This
procedure is called matrix assembly.
The element degrees of freedom (1,2,3,4) line up with the structural degrees of
freedom in your problem. For example, coordinates (1,2,3,4) might line up with
degrees of freedom (3,4,7,8) of the Beam. In this case, to assemble this element into
the structural stiffness matrix,

Page 52 of 161
Exercise No 01

Task 01: Develop the following Truss model in RISA 2D and Evaluate the member forces,
Reactions and deflection.
Solution:

Joint Reactions:
Joint label X (kN) Y (kN) MZ (N-m)
A -20 0 0
E 20 40 0
Totals: 0 40 0

Joint Deflections:
Joint label X (mm) Y (mm) Rotation (Rad.)
A 0 -8.141 -3.385e-4
B .054 -8.096 6.908e-4
C .084 -.076 9.065e-4
D -.032 -8.081 7.424e-4
E 0 0 9.047e-4

Member forces:
Member Forces Section Axial ( kN ) Shear ( kN ) Moment (N-m)
AB 1 -17.373 1.029 83.36
2 -17.373 1.029 4200.046
BC 1 -9.738 -7.53 15509.295
2 -9.738 -7.53 -14611.854
AD 1 -2.719 .753 -83.36
2 -2.719 .753 3681.74
DE 1 -10.262 -7.47 15277.08

Page 53 of 161
2 -10.262 -7.47 -14601.771
BD 1 -6.441 7.635 -11309.248
2 -6.441 7.635 11595.34
CE 1 -32.53 9.738 -14611.854
2 -32.53 9.738 14601.771

Member Deflections:
Member Labe Section x (mm) y (mm)
AB 1 0 -8.141
2 .054 -8.096
BC 1 .054 -8.096
2 .084 -.076
AD 1 -4.885 -6.513
2 -4.874 -6.446
DE 1 -.032 -8.081
2 0 0
BD 1 -8.096 -.054
2 -8.081 .032
CE 1 -.076 -.084
2 0 0

Page 54 of 161
Task 02: Develop the following Truss model in RISA 2D and Evaluate the member forces,
Reactions and deflection.
Solution:

Joint Reactions:
Joint label X (lb) Y (lb) MZ (k-ft)
A -176.77 134.874 0
E 0 216.896 0
Totals: -176.77 351.77 0

Joint Deflections:
Joint label X (in) Y (in) Rotation (Rad.)
A 0 0 -3.592e-5
B .002 -.003 -2.956e-6
C .002 -.003 5.444e-7
D .002 -.002 6.437e-6
E .004 0 3.221e-5
F .002 -.003 -2.131e-6

Member forces:
Member Forces Section Axial (lb) Shear (lb) Moment (k-ft)
AB 1 705.582 15.219 -.015
2 705.582 15.219 .025
3 705.582 15.219 .064
4 705.582 15.219 .104
5 705.582 15.219 .143
BC 1 615.787 -61.904 .136

Page 55 of 161
2 615.787 -61.904 .077
3 615.787 -61.904 .019
4 615.787 -61.904 -.04
5 615.787 -61.904 -.099
CD 1 617.998 70.111 -.102
2 617.998 70.111 -.035
3 617.998 70.111 .031
4 617.998 70.111 .098
5 617.998 70.111 .164
DE 1 659.313 -14.345 .124
2 659.313 -14.345 .087
3 659.313 -14.345 .05
4 659.313 -14.345 .013
5 659.313 -14.345 -.024
AF 1 -763.253 7.67 .015
2 -763.253 7.67 .037
3 -763.253 7.67 .059
4 -763.253 7.67 .081
5 -763.253 7.67 .103
FD 1 -70.932 -61.713 .151
2 -70.932 -61.713 .104
3 -70.932 -61.713 .056
4 -70.932 -61.713 .008
5 -70.932 -61.713 -.04
FB 1 714.87 45.872 -.076
2 714.87 45.872 -.041
3 714.87 45.872 -.005
4 714.87 45.872 .03
5 714.87 45.872 .066
EB 1 -524.688 -3.314 -.024
2 -524.688 -3.314 -.036
3 -524.688 -3.314 -.048
4 -524.688 -3.314 -.06
5 -524.688 -3.314 -.073
FC 1 -604.069 -7.367 .028
2 -604.069 -7.367 .021
3 -604.069 -7.367 .013
4 -604.069 -7.367 .005
5 -604.069 -7.367 -.003

Member Deflections:
Member Labe Section x (in) y (in)
AB 1 0 0
2 0 -.001
3 0 -.002
4 0 -.003
5 0 -.003

Page 56 of 161
BC 1 0 -.003
2 0 -.003
3 0 -.003
4 0 -.003
5 0 -.003
CD 1 .003 0
2 .003 0
3 .003 0
4 .003 0
5 .003 0
DE 1 .003 0
2 .003 0
3 .003 0
4 .003 .002
5 .003 .003
AF 1 0 0
2 0 -.001
3 0 -.002
4 0 -.003
5 0 -.003
FD 1 0 -.003
2 0 -.003
3 0 -.003
4 0 -.003
5 0 -.003
FB 1 -.003 .001
2 -.003 .001
3 -.003 .001
4 -.003 .001
5 -.003 .001
EB 1 -.003 -.002
2 -.003 0
3 -.003 0
4 -.003 0
5 -.003 .001
FC 1 -.003 -.002
2 -.003 -.002
3 -.003 -.002
4 -.003 -.002
5 -.003 -.002

Page 57 of 161
Task 03: Develop the following Truss model in RISA 2D and Evaluate the member forces,
Reactions and deflection.
Solution:

Joint Reactions:
Joint label X ( kN ) Y ( kN ) MZ ( N-m )
A 0 NC 0
E 0 15.5 0
Totals: 0 15.5 0

Joint Deflections:
Joint label X (mm) Y (mm) Rotation (Rad.)
A 0 -50 4.082e-3
B .04 -37.739 4.118e-3
C .085 -25.366 4.172e-3
D .13 -12.714 4.215e-3
E .165 0 4.241e-3
F -12.43 -12.696 4.189e-3

Member forces:
Member Forces Section Axial ( kN ) Shear ( kN ) Moment (N-m)
AB 1 -17.349 .141 -112.009
2 -17.349 .141 311.816
BC 1 -19.205 .222 -183.652
2 -19.205 .222 483.034
CD 1 -19.19 -.265 519.039
2 -19.19 -.265 -275.651
DE 1 -15.385 -.11 235.447
2 -15.385 -.11 -95.256
AH 1 24.542 .007 112.009
2 24.542 .007 140.158

Page 58 of 161
HG 1 19.581 .038 -2.357
2 19.581 .038 125.924
GF 1 17.431 -.073 166.455
2 17.431 -.073 -77.161
FE 1 21.761 -.003 108.507
2 21.761 -.003 95.256
BH 1 -8.568 -.147 299.327
2 -8.568 -.147 -142.515
GB 1 3.017 -.042 32.525
2 3.017 -.042 -196.141
GC 1 -24.513 .015 -33.059
2 -24.513 .015 36.005
GD 1 6.486 .04 -39.998
2 6.486 .04 177.456
FD 1 -7.529 .173 -185.668
2 -7.529 .173 333.642

Member Deflections:
Member Labe Section x (mm) y (mm)
AB 1 0 -50
2 .04 -37.739
BC 1 .04 -37.739
2 .085 -25.366
CD 1 .085 -25.366
2 .13 -12.714
DE 1 .13 -12.714
2 .165 0
AH 1 -35.355 -35.355
2 -35.436 -17.907
HG 1 -27.955 -28.194
2 -28.006 -14.262
GF 1 -5.394 -30.961
2 -5.44 -16.915
FE 1 .189 -17.767
2 .117 .117
BH 1 -37.739 -.04
2 -37.72 12.395
GB 1 31.391 -1.512
2 31.379 20.968
GC 1 25.28 -18.671
2 25.366 .085
GD 1 10.678 -29.558
2 10.651 -6.945
FD 1 12.696 -12.43
2 12.714 .13

Page 59 of 161
Task 04: Develop the following Truss model in RISA 2D and Evaluate the member forces,
Reactions and deflection.
Solution:

Joint Reactions:
Joint label X (kN) Y (kN) MZ (N-m)
A 0 20.75 0
E 0 10.25 0
Totals: 0 31 0

Joint Deflections:
Joint label X (mm) Y (mm) Rotation (Rad.)
A 0 0 -6.839e-5
B .018 -.123 -2.121e-5
C .037 -.101 1.613e-5
D .046 -.065 2.131e-5
E .055 0 3.621e-5
F .015 -.044 1.619e-5
G .017 -.06 1.073e-6
H .047 -.086 2.865e-6
I .058 -.075 -2.095e-5
J .037 -.109 -7.998e-6
K .019 -.077 1.2e-5

Member forces:
Member Forces Section Axial ( kN ) Shear ( kN ) Moment (N-m)
AB 1 -11.779 .416 -219.203
2 -11.779 .416 -11.439
3 -11.779 .416 196.324
4 -11.779 .416 404.087
5 -11.779 .416 611.851
BC 1 -11.85 -.342 496.921

Page 60 of 161
2 -11.85 -.342 326.166
3 -11.85 -.342 155.411
4 -11.85 -.342 -15.344
5 -11.85 -.342 -186.099
CD 1 -5.924 .028 -6.906
2 -5.924 .028 7.316
3 -5.924 .028 21.537
4 -5.924 .028 35.759
5 -5.924 .028 49.981
DE 1 -5.814 -.099 160.977
2 -5.814 -.099 111.493
3 -5.814 -.099 62.008
4 -5.814 -.099 12.524
5 -5.814 -.099 -36.961
AI 1 23.5 -.022 219.203
2 23.5 -.022 208.407
3 23.5 -.022 197.612
4 23.5 -.022 186.816
5 23.5 -.022 176.021
IH 1 9.579 -.276 375.214
2 9.579 -.276 237.192
3 9.579 -.276 99.171
4 9.579 -.276 -38.85
5 9.579 -.276 -176.872
HJ 1 -9.346 .186 -231.304
2 -9.346 .186 -138.273
3 -9.346 .186 -45.242
4 -9.346 .186 47.788
5 -9.346 .186 140.819
HG 1 9.549 -.029 54.432
2 9.549 -.029 25.352
3 9.549 -.029 -3.728
4 9.549 -.029 -32.809
5 9.549 -.029 -61.889
JC 1 4.51 .051 49.924
2 4.51 .051 75.216
3 4.51 .051 100.507
4 4.51 .051 125.798
5 4.51 .051 151.09
IJ 1 13.527 .055 -1.578
2 13.527 .055 26.151
3 13.527 .055 53.881
4 13.527 .055 81.61
5 13.527 .055 109.339
GF 1 9.438 .135 -71.636
2 9.438 .135 -4.336
3 9.438 .135 62.963
4 9.438 .135 130.262

Page 61 of 161
5 9.438 .135 197.562
FE 1 11.698 -.046 129.809
2 11.698 -.046 106.597
3 11.698 -.046 83.385
4 11.698 -.046 60.173
5 11.698 -.046 36.961
GK 1 -9.347 .036 9.747
2 -9.347 .036 27.637
3 -9.347 .036 45.528
4 -9.347 .036 63.418
5 -9.347 .036 81.309
KC 1 -7.225 .011 6.298
2 -7.225 .011 11.749
3 -7.225 .011 17.201
4 -7.225 .011 22.652
5 -7.225 .011 28.103
KF 1 2.122 -.067 84.221
2 2.122 -.067 50.82
3 2.122 -.067 17.42
4 2.122 -.067 -15.98
5 2.122 -.067 -49.381
IB 1 -13.89 .197 -197.615
2 -13.89 .197 -99.364
3 -13.89 .197 -1.114
4 -13.89 .197 97.137
5 -13.89 .197 195.388
JB 1 -13.85 -.256 200.234
2 -13.85 -.256 72.596
3 -13.85 -.256 -55.042
4 -13.85 -.256 -182.68
5 -13.85 -.256 -310.318
KD 1 -2.158 .048 -9.21
2 -2.158 .048 14.773
3 -2.158 .048 38.757
4 -2.158 .048 62.741
5 -2.158 .048 86.724
FD 1 -2.289 .003 18.372
2 -2.289 .003 19.847
3 -2.289 .003 21.322
4 -2.289 .003 22.797
5 -2.289 .003 24.272

Member Deflections:
Member Labe Section x (mm) y (mm)
AB 1 0 0
2 .005 -.036
3 .009 -.073

Page 62 of 161
4 .014 -.104
5 .018 -.123
BC 1 .018 -.123
2 .023 -.127
3 .027 -.121
4 .032 -.111
5 .037 -.101
CD 1 .037 -.101
2 .039 -.093
3 .041 -.084
4 .044 -.075
5 .046 -.065
DE 1 .046 -.065
2 .048 -.053
3 .05 -.036
4 .053 -.018
5 .055 0
AI 1 0 0
2 -.009 -.031
3 -.018 -.056
4 -.027 -.074
5 -.036 -.088
IH 1 -.036 -.088
2 -.04 -.093
3 -.044 -.091
4 -.048 -.087
5 -.051 -.084
HJ 1 .098 -.003
2 .102 -.004
3 .105 -.01
4 .109 -.017
5 .112 -.023
HG 1 .047 -.086
2 .039 -.081
3 .032 -.072
4 .024 -.064
5 .017 -.06
JC 1 .112 -.023
2 .111 -.026
3 .109 -.027
4 .107 -.025
5 .105 -.019
IJ 1 .058 -.075
2 .052 -.086
3 .047 -.095
4 .042 -.103
5 .037 -.109
GF 1 .06 -.015

Page 63 of 161
2 .057 -.015
3 .053 -.016
4 .049 -.014
5 .046 -.009
FE 1 .046 -.009
2 .041 .001
3 .037 .014
4 .032 .03
5 .027 .047
GK 1 .043 .045
2 .047 .045
3 .05 .047
4 .054 .05
5 .058 .055
KC 1 .058 .055
2 .06 .061
3 .063 .067
4 .066 .074
5 .069 .082
KF 1 .019 -.077
2 .018 -.07
3 .017 -.062
4 .016 -.052
5 .015 -.044
IB 1 .094 .012
2 .099 0
3 .105 -.017
4 .11 -.033
5 .116 -.046
JB 1 .076 .086
2 .081 .084
3 .087 .085
4 .092 .084
5 .097 .077
KD 1 .076 -.023
2 .077 -.017
3 .078 -.01
4 .079 -.003
5 .08 .007
FD 1 .03 .035
2 .031 .044
3 .032 .053
4 .033 .062
5 .034 .072

Page 64 of 161
Task 05: Develop the following Truss model in RISA 2D and Evaluate the member forces,
Reactions and deflection.
Solution:

Joint Reactions:
Joint label X (kN) Y (kN) MZ (N-m)
A 0 18 0
I 0 18 0
Totals: 0 36 0

Joint Deflections:
Joint label X (mm) Y (mm) Rotation (Rad.)
A -.248 0 -2.91e-4
B -.24 -.141 -2.403e-4
C -.209 -.384 -1.098e-4
D -.165 -.516 -4.109e-5
E -.124 -.539 -1.112e-6
F -.083 -.522 3.292e-5
G -.039 -.388 1.124e-4
H -.007 -.142 2.42e-4
I 0 0 2.928e-4
J -.117 -.246 1.72e-4
K -.166 -.388 9.475e-5
L -.18 -.47 6.124e-5
M -.186 -.536 2.555e-5
N -.161 -.549 -2.724e-5
O -.123 -.538 8.943e-6
P -.076 -.566 2.573e-5
Q -.058 -.541 -3.882e-5
R -.071 -.465 -6.3e-5

Page 65 of 161
S -.084 -.384 -9.283e-5
T -.131 -.244 -1.702e-4
U -.073 -.567 -2.803e-5
V -.179 -.549 5.317e-6

Member Forces:
Member Forces Section Axial ( kN ) Shear ( kN ) Moment (N-m)
AB 1 -19.194 6.246 -716.465
2 -19.194 6.246 64.24
3 -19.194 6.246 844.946
4 -19.194 6.246 1625.652
5 -19.194 6.246 2406.358
BC 1 -26.878 -.57 1151.593
2 -26.878 -.57 937.707
3 -26.878 -.57 723.822
4 -26.878 -.57 509.936
5 -26.878 -.57 296.051
CD 1 -28.591 -.235 520.688
2 -28.591 -.235 403.335
3 -28.591 -.235 285.982
4 -28.591 -.235 168.629
5 -28.591 -.235 51.276
DE 1 -26.357 -.244 410.15
2 -26.357 -.244 288.251
3 -26.357 -.244 166.353
4 -26.357 -.244 44.454
5 -26.357 -.244 -77.444
EF 1 -26.322 .183 -41.248
2 -26.322 .183 50.174
3 -26.322 .183 141.595
4 -26.322 .183 233.017
5 -26.322 .183 324.438
FG 1 -28.504 .141 189.249
2 -28.504 .141 259.937
3 -28.504 .141 330.626
4 -28.504 .141 401.314
5 -28.504 .141 472.003
GH 1 -26.873 .584 281.606
2 -26.873 .584 500.45
3 -26.873 .584 719.294
4 -26.873 .584 938.138
5 -26.873 .584 1156.982
HI 1 -19.189 -6.247 2407.571
2 -19.189 -6.247 1626.691
3 -19.189 -6.247 845.812
4 -19.189 -6.247 64.933
5 -19.189 -6.247 -715.946

Page 66 of 161
IJ 1 22.244 -.274 -715.946
2 22.244 -.274 -794.729
3 22.244 -.274 -873.512
4 22.244 -.274 -952.294
5 22.244 -.274 -1031.077
JK 1 32.964 .465 -824.745
2 32.964 .465 -690.491
3 32.964 .465 -556.236
4 32.964 .465 -421.982
5 32.964 .465 -287.727
KL 1 32.18 .806 -707.061
2 32.18 .806 -474.157
3 32.18 .806 -241.253
4 32.18 .806 -8.349
5 32.18 .806 224.555
LM 1 31.227 -.684 138.667
2 31.227 -.684 -59.122
3 31.227 -.684 -256.911
4 31.227 -.684 -454.7
5 31.227 -.684 -652.489
MN 1 31.002 .006 -385.369
2 31.002 .006 -383.532
3 31.002 .006 -381.695
4 31.002 .006 -379.859
5 31.002 .006 -378.022
NO 1 30.807 1.2 -433.113
2 30.807 1.2 -86.324
3 30.807 1.2 260.464
4 30.807 1.2 607.253
5 30.807 1.2 954.041
OP 1 29.817 -1.811 1167.353
2 29.817 -1.811 644.102
3 29.817 -1.811 120.852
4 29.817 -1.811 -402.399
5 29.817 -1.811 -925.649
PQ 1 30.662 .365 -676.791
2 30.662 .365 -571.759
3 30.662 .365 -466.726
4 30.662 .365 -361.693
5 30.662 .365 -256.661
QR 1 30.604 .843 -661.183
2 30.604 .843 -417.622
3 30.604 .843 -174.061
4 30.604 .843 69.5
5 30.604 .843 313.061
RS 1 32.077 -.87 287.878
2 32.077 -.87 36.558
3 32.077 -.87 -214.762

Page 67 of 161
4 32.077 -.87 -466.082
5 32.077 -.87 -717.402
ST 1 32.929 -.47 -285.668
2 32.929 -.47 -421.463
3 32.929 -.47 -557.257
4 32.929 -.47 -693.052
5 32.929 -.47 -828.846
TA 1 22.248 .273 -1030.379
2 22.248 .273 -951.9
3 22.248 .273 -873.422
4 22.248 .273 -794.944
5 22.248 .273 -716.465
TB 1 10.191 -1.282 -282.709
2 10.191 -1.282 -525.723
3 10.191 -1.282 -768.737
4 10.191 -1.282 -1011.751
5 10.191 -1.282 -1254.766
TC 1 -2.074 -.082 484.242
2 -2.074 -.082 460.557
3 -2.074 -.082 436.873
4 -2.074 -.082 413.188
5 -2.074 -.082 389.504
SC 1 .226 .537 -431.734
2 .226 .537 -277.321
3 .226 .537 -122.909
4 .226 .537 31.503
5 .226 .537 185.916
CR 1 .545 -.156 350.783
2 .545 -.156 272.882
3 .545 -.156 194.981
4 .545 -.156 117.08
5 .545 -.156 39.18
RD 1 1.736 .037 54.191
2 1.736 .037 72.723
3 1.736 .037 91.255
4 1.736 .037 109.787
5 1.736 .037 128.319
QU 1 -.143 -.565 404.522
2 -.143 -.565 241.105
3 -.143 -.565 77.687
4 -.143 -.565 -85.73
5 -.143 -.565 -249.147
RU 1 1.64 .135 10.172
2 1.64 .135 77.843
3 1.64 .135 145.514
4 1.64 .135 213.185
5 1.64 .135 280.857
UD 1 -1.209 .444 -497.542

Page 68 of 161
2 -1.209 .444 -275.965
3 -1.209 .444 -54.388
4 -1.209 .444 167.189
5 -1.209 .444 388.765
PU 1 -1.107 -.244 -248.858
2 -1.107 -.244 -318.956
3 -1.107 -.244 -389.055
4 -1.107 -.244 -459.153
5 -1.107 -.244 -529.252
OD 1 -.735 -.027 -50.166
2 -.735 -.027 -77.178
3 -.735 -.027 -104.189
4 -.735 -.027 -131.2
5 -.735 -.027 -158.211
OE 1 -.427 .035 -84.566
2 -.427 .035 -54.376
3 -.427 .035 -24.185
4 -.427 .035 6.006
5 -.427 .035 36.196
OF 1 -1.967 .064 -78.579
2 -1.967 .064 -14.328
3 -1.967 .064 49.922
4 -1.967 .064 114.172
5 -1.967 .064 178.422
NV 1 .072 .314 55.091
2 .072 .314 145.341
3 .072 .314 235.59
4 .072 .314 325.839
5 .072 .314 416.089
MV 1 -.188 .21 -267.12
2 -.188 .21 -206.404
3 -.188 .21 -145.688
4 -.188 .21 -84.972
5 -.188 .21 -24.256
LV 1 .582 -.159 -73.582
2 .582 -.159 -153.144
3 .582 -.159 -232.707
4 .582 -.159 -312.27
5 .582 -.159 -391.833
LF 1 2.166 -.196 77.673
2 2.166 -.196 -20.148
3 2.166 -.196 -117.969
4 2.166 -.196 -215.79
5 2.166 -.196 -313.612
LG 1 .299 .131 81.795
2 .299 .131 147.373
3 .299 .131 212.95
4 .299 .131 278.528

Page 69 of 161
5 .299 .131 344.105
JG 1 -2.098 .106 -492.347
2 -2.098 .106 -461.803
3 -2.098 .106 -431.259
4 -2.098 .106 -400.715
5 -2.098 .106 -370.171
JH 1 10.202 1.272 286.015
2 10.202 1.272 527.159
3 10.202 1.272 768.302
4 10.202 1.272 1009.445
5 10.202 1.272 1250.589
KG 1 .311 -.508 419.334
2 .311 -.508 273.418
3 .311 -.508 127.502
4 .311 -.508 -18.415
5 .311 -.508 -164.331

Member Deflections:
Member Labe Section x (mm) y (mm)
AB 1 -.248 AB
2 -.246
3 -.244
4 -.242
5 -.24
BC 1 -.24 BC
2 -.232
3 -.225
4 -.217
5 -.209
CD 1 -.209 CD
2 -.198
3 -.187
4 -.176
5 -.165
DE 1 -.165 DE
2 -.154
3 -.144
4 -.134
5 -.124
EF 1 -.124 EF
2 -.113
3 -.103
4 -.093
5 -.083
FG 1 -.083 FG
2 -.072
3 -.061

Page 70 of 161
4 -.05
5 -.039
GH 1 -.039 GH
2 -.031
3 -.023
4 -.015
5 -.007
HI 1 -.007 HI
2 -.006
3 -.004
4 -.002
5 0
IJ 1 0 IJ
2 -.005
3 -.01
4 -.015
5 -.02
JK 1 -.022 JK
2 -.029
3 -.037
4 -.044
5 -.051
KL 1 -.051 KL
2 -.059
3 -.066
4 -.073
5 -.08
LM 1 -.08 LM
2 -.087
3 -.094
4 -.101
5 -.108
MN 1 -.104 MN
2 -.111
3 -.118
4 -.125
5 -.132
NO 1 -.136 NO
2 -.143
3 -.15
4 -.157
5 -.164
OP 1 .376 OP
2 .369
3 .363
4 .356
5 .349
PQ 1 .346 PQ

Page 71 of 161
2 .339
3 .332
4 .325
5 .318
QR 1 .322 QR
2 .315
3 .308
4 .301
5 .294
RS 1 .294 RS
2 .287
3 .28
4 .273
5 .266
ST 1 .266 ST
2 .258
3 .251
4 .243
5 .236
TA 1 .235 TA
2 .23
3 .225
4 .22
5 .215
TB 1 .27 TB
2 .269
3 .267
4 .266
5 .264
TC 1 .007 TC
2 .007
3 .008
4 .008
5 .009
SC 1 .384 SC
2 .384
3 .384
4 .384
5 .384
CR 1 -.437 CR
2 -.437
3 -.437
4 -.438
5 -.438
RD 1 .367 RD
2 .366
3 .366
4 .365

Page 72 of 161
5 .364
QU 1 .221 QU
2 .221
3 .221
4 .221
5 .221
RU 1 -.071 RU
2 -.071
3 -.072
4 -.073
5 -.073
UD 1 .527 UD
2 .528
3 .528
4 .529
5 .529
PU 1 .566 PU
2 .566
3 .566
4 .566
5 .567
OD 1 .527 OD
2 .527
3 .528
4 .529
5 .529
OE 1 .538 OE
2 .538
3 .538
4 .538
5 .539
OF 1 .404 OF
2 .405
3 .407
4 .409
5 .41
NV 1 .549 NV
2 .549
3 .549
4 .549
5 .549
MV 1 .43 MV
2 .43
3 .43
4 .43
5 .43
LV 1 .18 LV
2 .179

Page 73 of 161
3 .179
4 .179
5 .179
LF 1 .496 LF
2 .496
3 .495
4 .494
5 .493
LG 1 .317 LG
2 .317
3 .316
4 .316
5 .316
JG 1 .224 JG
2 .224
3 .225
4 .225
5 .226
JH 1 .107 JH
2 .106
3 .104
4 .103
5 .101
KG 1 .388 KG
2 .388
3 .388
4 .388
5 .388

Page 74 of 161
Exercise No 02

Task 01: Develop the following Beam model in RISA 2D and Evaluate the member forces,
Reactions and deflection.

Solution:
Joint Reaction:
Joint label X (k) Y (k) MZ (lb-ft)
A 0 6.855 40516.327
C 0 1.145 0
Totals: 0 8 40516.327

Joint Deflections:
Joint label X (in) Y (in) Rotation (Rad.)
A 0 0 0
B 0 -.971 1.355e-3
C 0 0 7.306e-3

Member forces:
Member Forces Section Axial (k) Shear (k) Moment (lb-ft)
AB 1 0 6.855 -40516.327
2 0 -1.145 16578.717
BC 1 0 -1.145 16578.717
2 0 -1.145 -600

Member Deflections:
Member Labe Section x (in) y (in)
AB 1 0 0
2 0 -.971
BC 1 0 -.971
2 0 0

Page 75 of 161
Task 02: Develop the following Beam model in RISA 2D and Evaluate the member forces,
Reactions and deflection.

Solution:
Joint Reaction:
Joint label X (k) Y (k) MZ (k-ft)
A 0 5.827 41.237
C 0 2.173 0
Totals: 0 8 41.237

Joint Deflections:
Joint label X (in) Y (in) Rotation (Rad.)
A 0 0 0
B 0 -.45 5.58e-3
C 0 0 -4.624e-3

Member forces:
Member Forces Section Axial (k) Shear (k) Moment (k-ft)
AB 1 0 5.827 -41.237
2 0 5.827 -6.277
3 0 -2.173 28.682
4 0 -2.173 15.642
5 0 -2.173 2.601
BC 1 0 -2.173 2.601
2 0 -2.173 -5.549
3 0 -2.173 -13.699
4 0 -2.173 -21.85
5 0 -2.173 -30

Member Deflections:
Member Labe Section x (in) y (in)
AB 1 0 0
2 0 -.317
3 0 -.769
4 0 -.778
5 0 -.45
BC 1 0 -.45
2 0 -.2

Page 76 of 161
3 0 .004
4 0 .094
5 0 0

Page 77 of 161
Task 03: Develop the following Beam model in RISA 2D and Evalute the member forces,
Reactions and deflection.

Solution:
Joint Reaction:
Joint label X (k) Y (k) MZ (k-ft)
A 0 1.557 0
B 0 6.381 0
C 0 3.662 0
Totals: 0 11.6 0

Joint Deflections:
Joint label X (in) Y (in) Rotation (Rad.)
A 0 0 2.445e-3
B 0 0 -2.804e-3
C 0 0 5.215e-3
D 0 2.715 4.591e-4
Z 0 -6.65 4.232e-3

Member forces:
Member Forces Section Axial (k) Shear (k) Moment (k-ft)
AB 1 0 -.221 -6000
2 0 -.221 -6774.783
3 0 -.221 -7549.565
4 0 -.221 -8324.348
5 0 -.221 -9099.13
AD 1 0 -.221 -6000
2 0 -.221 -6332.05
3 0 -.221 -6664.099
4 0 -.221 -6996.149
5 0 -.221 -7328.199
DB 1 0 -.221 -7328.199
2 0 -.221 -7770.932
3 0 -.221 -8213.665
4 0 -.221 -8656.398
5 0 -.221 -9099.13
BC 1 0 5.938 -18213.261
2 0 5.938 5540.054

Page 78 of 161
3 0 -3.662 29293.37
4 0 -3.662 14646.685
5 0 -3.662 0
ZA 1 0 -2 0
2 0 -2 -3000
3 0 -2 -6000
4 0 -2 -9000
5 0 -2 -12000

Member Deflections:
Member Labe Section x (in) y (in)
AB 1 0 0
2 0 2.028
3 0 2.799
4 0 2.171
5 0 0
AD 1 0 0
2 0 1.014
3 0 1.812
4 0 2.383
5 0 2.715
DB 1 0 2.715
2 0 2.769
3 0 2.352
4 0 1.438
5 0 0
BC 1 0 0
2 0 -4.665
3 0 -7.988
4 0 -5.767
5 0 0
ZA 1 0 -6.65
2 0 -4.732
3 0 -2.916
4 0 -1.305
5 0 0

Page 79 of 161
Task 04: Develop the following Beam model in RISA 2D and Evaluate the member forces,
Reactions and deflection.

Solution:
Joint Reaction:
Joint label X (kN) Y (kN) MZ (KN-m)
A 10 16 0
B 0 48 0
Totals: 10 64 0

Joint Deflections:
Joint label X (mm) Y (mm) Rotation (Rad.)
A 0 0 -5.191e-2
B -.116 0 5.623e-2

Member forces:
Member Forces Section Axial ( kN ) Shear ( kN ) Moment (kN-m)
AB 1 10 16 0
2 10 -24 0

Member Deflections:
Member Labe Section x (mm) y (mm)
AB 1 0 0
2 -.116 0

Page 80 of 161
Task 05: Develop the following Beam model in RISA 2D and Evaluate the member forces,
Reactions and deflection.

Solution:

Joint Reaction:
Joint label X (k) Y (k) MZ (k-ft)
A 0 3.333 0
B 0 6.667 0
Totals: 0 10 0

Joint Deflections:
Joint label X (in) Y (in) Rotation (Rad.)
A 0 0 0
B 0 0 0

Member forces:
Member Forces Section Axial (k) Shear (k) Moment (k-ft)
AB 1 0 3.333 0
2 0 -6.667 0

Member Deflections:
Member Labe Section x (in) y (in)
AB 1 0 0
2 0 0

Page 81 of 161
Exercise No 02

Task 01: Develop the following Frame model in RISA 2D and Evaluate the member forces,
Reactions and deflection.

Solution:

Joint label X (lb) Y (lb) MZ (lb-ft)


A -613.902 1361.647 1069.028
C -76.513 1098.689 245.057
B -509.585 985.818 197.638
Totals: -1200 3446.154 1511.723

Joint Deflections:
Joint label X (in) Y (in) Rotation (Rad.)
A 0 0 0
B 0 0 0
C 0 0 0
H 0 0 2.397e-7
I 0 0 6.828e-5

Member forces:
Member Forces Section Axial (lb) Shear (lb) Moment (lb-ft)
AH 1 1361.647 613.902 -1069.028
2 1361.647 313.902 90.727
3 1361.647 13.902 500.483
4 1361.647 -286.098 160.238
5 561.647 -586.098 -930.007
HB 1 757.031 293.021 -930.007
2 757.031 293.021 22.311

Page 82 of 161
3 757.031 -306.979 974.629
4 757.031 -306.979 -23.054
5 757.031 -706.979 -1020.788
BI 1 185.508 753.715 -1218.426
2 185.508 353.715 -68.799
3 185.508 -246.285 1080.776
4 185.508 -246.285 280.351
5 185.508 -246.285 -520.074
IC 1 298.689 76.513 -520.074
2 1098.689 76.513 -328.791
3 1098.689 76.513 -137.509
4 1098.689 76.513 53.774
5 1098.689 76.513 245.057

Member Deflections:
Member Labe Section x (in) y (in)
AH 1 0 0
2 0 -.001
3 0 -.002
4 0 -.002
5 0 0
HB 1 0 0
2 0 -.003
3 0 -.004
4 0 -.002
5 0 0
BI 1 0 0
2 0 -.003
3 0 -.006
4 0 -.004
5 0 0
IC 1 0 0
2 0 0
3 0 0
4 0 0
5 0 0

Page 83 of 161
Task 02: Develop the following Frame model in RISA 2D and Evaluate the member forces,
Reactions and deflection.

Solution:
Joint Reactions:
Joint label X (kN) Y (kN) MZ (KN-m)
A -20 0 0
E 20 40 0
Totals: 0 40 0

Joint Deflections:
Joint label X (mm) Y (mm) Rotation (Rad.)
A 0 0 -2.326e-1
B 534.357 34.782 0
C 0 0 -1.984e-1
D 568.12 .279 -1.11e-1
E 497.784 -.558 -1.037e-1

Member forces:
Member Forces Section Axial ( kN ) Shear ( kN ) Moment (kN-m)
AD 1 -120 285 0
2 -120 105 585
DB 1 -159.099 -10.607 585
2 -159.099 -265.165 0
BE 1 265.165 -159.099 0
2 265.165 -74.246 -495
EC 1 240 135 -495
2 240 195 0

Page 84 of 161
Member Deflections:
Member Labe Section x (mm) y (mm)
AD 1 0 0
2 .279 -568.12
DB 1 401.919 -401.524
2 402.442 -353.253
BE 1 353.253 402.442
2 352.381 351.592
EC 1 .558 497.784
2 0 0

Page 85 of 161
Task 03: Develop the following Frame model in RISA 2D and Evaluate the member forces,
Reactions and deflection.

Solution:
Joint Reactions:
Joint label X (kN) Y (kN) MZ (KN-m)
A 17.32 13.333 0
C -8.84 20.147 0
Totals: 8.48 33.48 0

Joint Deflections:
Joint label X (mm) Y (mm) Rotation (Rad.)
A 0 0 -6.177e-3
B -.081 -.215 0
C 0 0 2.338e-3

Member forces:
Member Forces Section Axial ( kN ) Shear ( kN ) Moment (kN-m)
AB 1 17.32 13.333 0
2 17.32 -11.667 0
BC 1 20.497 3.998 0
2 20.497 -7.995 0

Member Deflections:
Member Labe Section x (mm) y (mm)
AB 1 0 0
2 -.081 -.215
BC 1 .095 -.209
2 0 0

Page 86 of 161
Task 04: Develop the following Frame model in RISA 2D and Evaluate the member forces,
Reactions and deflection.

Solution:

Joint Reactions:
Joint label X (kN) Y (kN) MZ (KN-m)
A -1.75 10.167 0
D -10.25 14.833 0
Totals: -12 25 0

Joint Deflections:
Joint label X (mm) Y (mm) Rotation (Rad.)
A 0 0 -1.028e-2
B 33.574 -25.215 0
C 33.527 -.046 -1.813e-3
D 0 0 -1.167e-2

Member forces:
Member Forces Section Axial ( kN ) Shear ( kN ) Moment (kN-m)
AB 1 7.083 7.5 0
2 7.083 -7.5 0
BC 1 10.25 1.167 0
2 10.25 -14.833 -41
CD 1 14.833 10.25 -41
2 14.833 10.25 0

Member Deflections:
Member Labe Section x (mm) y (mm)
AB 1 0 0
2 -.027 -41.988
BC 1 33.574 -25.215
2 33.527 -.046
CD 1 .046 33.527
2 0 0

Page 87 of 161
Task 05: Develop the following Frame model in RISA 2D and Evaluate the member forces,
Reactions and deflection.

Solution:
Joint Reaction:
Joint label X (kN) Y (kN) MZ (KN-m)
A 0 1.557 0
B 0 6.381 0

Joint Deflections:
Joint label X (mm) Y (mm) Rotation (Rad.)
A 0 0 0
B 1.802 -.008 -1.802e-3
C 8.828 -4.073 -3.155e-3

Member forces:
Member Forces Section Axial ( kN ) Shear ( kN ) Moment (kN-m)
AB 1 5 0 -7.5
2 5 0 -7.5
3 5 0 -7.5
4 5 0 -7.5
5 5 0 -7.5
BC 1 4.331 2.499 -7.5
2 4.331 2.499 -5.625
3 4.331 2.499 -3.75
4 4.331 2.499 -1.875
5 4.331 2.499 0

Page 88 of 161
Member Deflections:
Member Labe Section x (mm) y (mm)
AB 1 0 0
2 -.002 -.113
3 -.004 -.451
4 -.006 -1.014
5 -.008 -1.802
BC 1 .894 -1.565
2 .891 -3.15
3 .889 -5.116
4 .886 -7.335
5 .884 -9.682

Page 89 of 161
Exercise NO 4

How to write matrix in MATLAB?


TASK NO 01

Job 01: Write down the given matrix in MATLAB

4 4 2

[ ]
A= 6
7
4 3
0 4

MATLAB Code:
A=[4,4,1;6,4,3;7,0,4]

Results:

Job 02: Write down the given matrix in MATLAB

2 4

[ ]
B= 10 15
0 1

MATLAB Code:
B=[2,4;10,15;0,1]
Results:

Page 90 of 161
Job 03: Write down the given matrix in MATLAB

C= [ 126 7 1
4 5 ]
MATALAB Code:
C=[6,7,1;12,4,5]
Results:

Job 04: Write down the given matrix in MATLAB

D= [ 46 58]
MATALAB Code:
D=[4,5;6,8]

Results:

Job 05: Write down the given matrix in MATLAB

5 4 3 2

[
E- 1 0 3 1
6 7 8 9 ]
MATLAB Code:

E=[5,4,3,2;1,0,3,1;6,7,8,9]

Results:

Page 91 of 161
3. Job 06: Write down the given matrix in MATLAB

1 19
F=
2
3
4
[ ] 14
17
19

MATLAB Code:
F=[1,10;2,14;3,17;4,19]

Results:

4. Job 07: Write down the given matrix in MATLAB

4 4 7 2
G= 8
4 [ 9 10 13
4 4 12 ]
MATLAB Code:
G=[4,4,7,2;8,9,10,13;4,4,4,12]
Results:

Page 92 of 161
Job 08: Write down the given matrix in MATLAB

4 1 6 9 12

[
H= 4 2 7 10 13
4 3 8 11 19 ]
MATLAB Code:
H=[4,1,6,9,12;4,2,7,10,13;4,3,8,11,19]
Results:

5. Job 09: Write down the given matrix in MATLAB

1 10 14 18
I=
2
3
4
[ 11
12
13
15
16
17
19
20
25
]
MATLAB Code:
I=[1,10,14,18;2,11,15,19;3,12,16,20;4,13,17,2 ]
Results:

6.

Page 93 of 161
7. Job 10: Write down the given matrix in MATLAB

2 4 8 10 12 14

J=
[
1 3 5
4 8 12
3 6 9
6 12 18
5 10 15
7
16
12
24
20
8
20
15
30
25
11
24
18
36
30
]
MATALAB Code:
J=[2,4,8,10,12,14;1,3,5,7,9,11;4,8,12,16,20,24;3,6,9,12,15,
18;6,12,18,24,30,36;5,10,15,20,25 ,30]

Results:

Page 94 of 161
STRUCTURAL ENGINEERING LAB

Task N0 02

How add two matrixes?

Job: Add the following given matrixes.

4 4 2 2 4

[ ] [ ]
A= 6
7
4 3 B= 10 15
0 4 0 1

MATALAB Code:

A=[4,4,1;6,4,3;7,0,4]

MATLAB Code:
B=[9,8,7;6,5,4;3,2,1]

C=A+B

Results:

Page 95 of 161
STRUCTURAL ENGINEERING LAB

Task NO 03

How to Subtract the matrixes?

Job: Subtract the matrix B from A.

4 4 2 2 4

[ ] [ ]
A= 6
7
4 3 B= 10 15
0 4 0 1

MATALAB Code:

A=[4,4,1;6,4,3;7,0,4]

MATLAB Code:
B=[9,8,7;6,5,4;3,2,1]

C=A*B

Results:

Page 96 of 161
STRUCTURAL ENGINEERING LAB

Task NO 04

How to do Multiplication of matrixes?

Job: Multiply the following matrixes.

4 4 2 2 4

[ ] [ ]
A= 6
7
4 3 B= 10 15
0 4 0 1

MATALAB Code:

A=[4,4,1;6,4,3;7,0,4]

MATLAB Code:
B=[9,8,7;6,5,4;3,2,1]

C=A*B

Results:

Page 97 of 161
STRUCTURAL ENGINEERING LAB

Task NO 05

How to find the invers of matrix?

Job: Find the invers of the following matrix.

4 4 2

[ ]
A= 6
7
4 3
0 4

MATALAB Code:
A=[4,4,1;6,4,3;7,0,4]

MATLAB Code:
B=inv(A)
Results:

Page 98 of 161
STRUCTURAL ENGINEERING LAB

Task NO 06

How to find the values of trigonometric function?

Job: Find the values of Sine function.

MATLAB Code:
A=3:3:130

Page 99 of 161
STRUCTURAL ENGINEERING LAB

Job 02: Find the values of Cose function.

MATALAB Code:
A=3:3:130

Page 100 of 161


STRUCTURAL ENGINEERING LAB

Task NO 07

How to plot graph by MATLAB?

Job 01: Plot a graph between real numbers and Sine values of these numbers.

MATLAB Code:
A=3:3:130

Page 101 of 161


STRUCTURAL ENGINEERING LAB

plot(A,B)
>> xlabel('X=A')
>> ylabel('Sine of X')
>> title('Plot of the Sine function')

Page 102 of 161


STRUCTURAL ENGINEERING LAB

Job 02: Plot a graph between real numbers and Cose values of these numbers.

MATLAB Code:
C=cos(A)

plot(A,C)

>> xlabel('X=A')
>> ylabel('Cose of X')
>> title('Plot of the Cose function')

Page 103 of 161


STRUCTURAL ENGINEERING LAB

Job 03: Plot a graph between Sine and Cose values.

MATLAB Code:

plot(B,C)
>> xlabel('X=B')
>> ylabel('X=C')
>> title('Plot of the Sine snd Cose function')

Page 104 of 161


STRUCTURAL ENGINEERING LAB

Job 04: Plot the graph of different color.

MATLAB Code:
A=1:5:100

>> plot(A,B)

>> plot(A,B,'g')

Page 105 of 161


STRUCTURAL ENGINEERING LAB

Task N0 08

How to get the specific entry from any matrix from any row and column?

2 4 8 10 12 14

A=
[
1 3 5
4 8 12
3 6 9
6 12 18
5 10 15
7
16
12
24
20
8
20
15
30
25
11
24
18
36
30
]
MATALAB Code:

J=[2,4,8,10,12,14;1,3,5,7,9,11;4,8,12,16,20,24;3,6,9,12,15,18;
6,12,18,24,30,36;5,10,15,20,25 ,30]
Results:

Job 01:

MATLAB Code:

B=A(2,3)

Results:

Page 106 of 161


STRUCTURAL ENGINEERING LAB

Job 02:

MATLAB Code:

C=A(4,4)

Results:

Job 03:

MATLAB Code:

D=A(5,6)

Results:

Job 04:

MATLAB Code:

E= A(2,[1,3])

Results:

Page 107 of 161


STRUCTURAL ENGINEERING LAB

Job 05:

MATLAB Code:

F=A(6,[4,6])

Results:

Page 108 of 161


STRUCTURAL ENGINEERING LAB

Task NO 09

How to get the complete sub matrix from the matrix?

2 4 8 10 12 14

A=
[
1 3 5
4 8 12
3 6 9
6 12 18
5 10 15
7
16
12
24
20
8
20
15
30
25
11
24
18
36
30
]
MATALAB Code:
J=[2,4,8,10,12,14;1,3,5,7,9,11;4,8,12,16,20,24;3,6,9,12,15,18;
6,12,18,24,30,36;5,10,15,20,25 ,30]
Results:

Job 01:

MATLAB Code:

B=A([2,3,4],[4,5,6])

Results:

Page 109 of 161


STRUCTURAL ENGINEERING LAB

Job 02:

MATLAB Code:

C=A([1,2,6],[3,4,5])

Results:

Page 110 of 161


STRUCTURAL ENGINEERING LAB

Task NO 10

How to draw null matrix in MATALAB?

Job 01: Draw the given null matrix in MATLAB.

0 0 0 0

A=
[ ]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

MATALAB Code:

A=zeros(6,4)

Results:

Job 02: Write the given matrix in MATLAB.

0 0 0 0

[
B= 0 0 0 0
0 0 0 0 ]
MATLAB Code:

B=zeros(3,4)

Results:

Page 111 of 161


STRUCTURAL ENGINEERING LAB

Job 03: Write the given null matrix in MATLAB.

0 0 0 0 0 0 0 0 0 0 0 0

[ ]
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
C=
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0

MATLAB Code:

C=zeros(10,12)

Results:

Page 112 of 161


STRUCTURAL ENGINEERING LAB

Task NO 11

How to clear workspace?

Job: Clear all the space.

MATLAB Code: clc


clear all

Page 113 of 161


STRUCTURAL ENGINEERING LAB

Exercise No 05

Task N0 01

Job-01: Write down the following array in MATLAB and choose the mentioned location
identities.

x=1:3:130
[10 15 20 25]

MATLAB Code:

z= []
x=1:3:130
for a=[10,15,20,25]
z=30+x(:,a)
end

Results

Page 114 of 161


STRUCTURAL ENGINEERING LAB

Job 02: Write down the example to show horizontal containment.

a=[10,15,20,25]
[10 15 20 25]
MATLAB Code:

z=[]
x=1:3:130
for a=[10,15,20,25]
z=30+x(:,a)
end
A=1:0.5:500
for a=[10,15,20,25]
z=[z,30+x(:,a)]
end

Results:

Job-03: write down the example to show vertical containment.

MATLAB Code:

z=[]
x=1:3:130
for a=[10,15,20,25]
z=30+x(:,a)
end
A=1:0.5:500

Page 115 of 161


STRUCTURAL ENGINEERING LAB

for a=[10,15,20,25]
z=[z;30+x(:,a)]
end

Results:

Page 116 of 161


STRUCTURAL ENGINEERING LAB

Task N0 02
Job-01: plot the graph between t and answer value for f(t)=4-t^2*e^-3t, put the values 0<t<30
MATLAB Code:

z=[]
x=0:30
for t=0:1:30
z=[z,4-t^2*exp(-3*t)]
end
plot(x,z)
plot(x,z,'r')
xlabel('X=x')
ylabel('Y=z')
title('Plot between t and f(t)')

Results:

Job-02: Consider the iteration x(k+1)=1.2x(k)-0.2. Compute the first 10 values of this
iteration starting with x(1)=3.

MATLAB Code:
x=3
z=1:10

Page 117 of 161


STRUCTURAL ENGINEERING LAB

for z=1:10
x=1.2*x-0.2
end

Results:

Page 118 of 161


STRUCTURAL ENGINEERING LAB

Job-03: Suppose that you are building a mobile robot and are designing the size of the
wheels on the robot to achieve a given travel speed. Denote the radius of the wheel ( in
inches) as r and the rotation per second of the wheel as w. The robot speed s ( in inches ) is
related to r and w by equation
S=2𝜋rw
On the graph, creates plots of the relationship between s and w for values of r of 0.5in, o.7in,
1,6in, 3.2in and 4.0in.

MATLAB Code:

w=1:5
for r=[0.5,0.7,1.6,3.2,4]
s=2*pi*r*w
end
plot(s,w)
xlabel('X=s')
ylabel('Y=w')
title('Plot between s and w for given values of r')

Results:

Page 119 of 161


STRUCTURAL ENGINEERING LAB

Exercise No 06

Task No 01

Multiplication:

Job 01: Write the function of multiplication in the MATLAB

4 3 2 1
A=
[8 7 6 5
12 11 10 9
16 15 14 13
]
MATLAB Code:

function P=Shahzaib(A)
P=5*A
clc
clear all
A=[4,3,2,1;8,7,6,5;12,11,10,9;16,15,14,13]
P=Shahzaib(A)

Page 120 of 161


STRUCTURAL ENGINEERING LAB

Results:

Job 02: Write the function of multiplication in the MATLAB:

5 10
A= 15
[ ]
20
25 30

MATLAB Code:

function P=Shahzaib(A)
P=15*A
clc
clear all
A=[5,10;15,20;25,30]
P=Shahzaib(A)

Results:

Job 03: Write the function of multiplication in the MATLAB:

A= [ 133 11 9 23
2 88 19 ]
MATLAB Code:

function P=Shahzaib(A)
P=13*A
clc
clear all
A=[13,11,9,23;3,2,88,19]

Page 121 of 161


STRUCTURAL ENGINEERING LAB

P=Shahzaib(A)

Results:

Job 04: Write the function of multiplication in the MATLAB

25 50 75 100
A=
[
150 200 250 300
350 400 450 500 ]
MATLAB Code:

function P=Shahzaib(A)
P=120*A
clc
clear all
A=[25,50,75,100;150,200,250,300;350,400,450,500]
P=Shahzaib(A)

Results:

Job 05: Write the function of multiplication in the MATLAB:

11 13 15
A=
[ ]
17
23
29
19
25
31
21
27
33

MATLAB Code:

Page 122 of 161


STRUCTURAL ENGINEERING LAB

function P=Shahzaib(A)
P=12*A
clc
clear all
A=[11,13,15;17,19,21;23,25,27;29,31,33]
P=Shahzaib(A)

Results:

Task No 02

Job 01: Write the function of summation in the MATLAB:

1 2 3 9 8 7

[ ] [ ]
A= 4 5 6 B= 6 5 4
7 8 9 3 2 1

MATLAB Code:

function P=Sum(A,B)
P=A+B
clc
clear all

Page 123 of 161


STRUCTURAL ENGINEERING LAB

A=[1,2,3;4,5,6;7,8,9]
B=[9,8,7;6,5,4;3,2,1]
P=Sum(A,B)

Results

Job 02: Write the function of summation in the MATLAB:

12 13 14 15 1 2 3 4
A=
[12
12
12
13
13
13
14
14
14
][
15
15
15
B=
5 6 7 8
9 10 11 12
13 14 15 16
]
MATLABB Code:

function P=Sum(A,B)
P=A+B
clc
clear all
A=[12,13,14,15;12,13,14,15;12,13,14,15;12,13,14,15]
B=[1,2,3,4;5,6,7,8;9,10,11,12;13,14,15,16]
P=Sum(A,B)

Results:

Job 03: Write the function of summation in the MATLAB:

Page 124 of 161


STRUCTURAL ENGINEERING LAB

25 50 75 100 7 8 9 10 4 4 4 4

[
350 400 450 500 ] [
A= 150 200 250 300 B = 25 30 35 40 C = 4
33 35 36 39 4 ] [ 4 4 4
4 4 4 ]
MATLAB Code:

function P=Sum(A,B,C)
P=A+B+C
clc
clear all
A=[25,50,75,100;150,200,250,300;350,400,450,500]
B=[7,8,9,10;25,30,35,40;33,35,36,39]
C=[4,4,4,4;4,4,4,4;4,4,4,4]
P=Sum(A,B,C)

Results:

Job 04: Write the function of summation in the MATLAB:

11 13 15 33 33 33
A=
[ ][ ]
17
23
29
19
25
31
21
27
33
B=
33 33
33 33
33 33
33
33
33

MATLAB Code:

function P=Sum(A,B)
P=A+B

Page 125 of 161


STRUCTURAL ENGINEERING LAB

clc
clear all
A=[11,13,15;17,19,21;23,25,27;29,31,33]
B=[33,33,33;33,33,33;33,33,33;33,33,33]
P=Sum(A,B)

Results:

Task No 03
Subtraction

Job 01: Write the function of summation in the MATLAB:

MATLAB Code:

Page 126 of 161


STRUCTURAL ENGINEERING LAB

function P=Subt(A,B)
P=A-B
clc
clear all
A=[1,2,3;4,5,6;7,8,9]
B=[9,8,7;6,5,4;3,2,1]
P=Sum(A,B)

Results:

Job 02: Write the function of summation in the MATLAB:

MATLABB Code:

function P=Subt(A,B)
P=A-B
clc
clear all
A=[12,13,14,15;12,13,14,15;12,13,14,15;12,13,14,15]
B=[1,2,3,4;5,6,7,8;9,10,11,12;13,14,15,16]
P=Subt(A,B)

Results:

Job 03: Write the function of summation in the MATLAB

Page 127 of 161


STRUCTURAL ENGINEERING LAB

25 50 75 100 7 8 9 10 4 4 4 4

[
350 400 450 500 ] [
A= 150 200 250 300 B = 25 30 35 40 C = 4
33 35 36 39 4 ] [ 4 4 4
4 4 4 ]
MATLAB Code:

function P=Subt(A,B,C)
P=A-B-C
clc
clear all
P=Subt(A,B,C)

Results:

Task No 04
Circle

Job 01: Calculate the Area and Circumference of the Circle:


r=5

MATLAB Code:

function [Area,Circumference]=circle(r)
Area=3.14*r^2

Page 128 of 161


STRUCTURAL ENGINEERING LAB

Circumference=2*3.14*r
clc
clear all
r=5
[Area,Circumference]=circle(r)

Results:

Job 02: Calculate the Area and Circumference of the Circle:

R=10

MATLAB Code:

function [Area,Circumference]=circle(r)
Area=3.14*r^2
Circumference=2*3.14*r
clc
clear all
r=10
[Area,Circumference]=circle(r)

Results:

Page 129 of 161


STRUCTURAL ENGINEERING LAB

Job 03: Calculate the Area and Circumference of the Circle:

R=15

MATLAB Code:

function [Area,Circumference]=circle(r)
Area=3.14*r^2
Circumference=2*3.14*r
clc
clear all
r=15
[Area,Circumference]=circle(r)

Results:

Job 04: Calculate the Area and Circumference of the Circle:

r=8

MATLAB Code:

function [Area,Circumference]=circle(r)
Area=3.14*r^2
Circumference=2*3.14*r
clc
clear all
r=8
[Area,Circumference]=circle(r)

Results:

Page 130 of 161


STRUCTURAL ENGINEERING LAB

Job 05: Calculate the Area and Circumference of the Circle:

r=20

MATLAB Code:

function [Area,Circumference]=circle(r)
Area=3.14*r^2
Circumference=2*3.14*r
clc
clear all
r=20
[Area,Circumference]=circle(r)

Results:

Task No 05
Cube

Job 01: Find out the Volume and areas of all sides of the cube:

MATLAB Code:

function [Axy,Ayz,Axz,Vxyz]=cube(x,y,z)
Axy=x*y
Ayz=y*z

Page 131 of 161


STRUCTURAL ENGINEERING LAB

Axz=x*z
Vxyz=x*y*z
clc
clear all
x=5
y=5
z=5
[Axy,Ayz,Axz,Vxyz]=cube(x,y,z)

Results:

Job 02: Find out the Volume and areas of all sides of the cube:

MATLAB Code:

function [Axy,Ayz,Axz,Vxyz]=cube(x,y,z)
Axy=x*y
Ayz=y*z
Axz=x*z
Vxyz=x*y*z
clc
clear all
x=7

Page 132 of 161


STRUCTURAL ENGINEERING LAB

y=7
z=7
[Axy,Ayz,Axz,Vxyz]=cube(x,y,z)

Results:

Job 03: Find out the Volume and areas of all sides of the cube:

MATLAB Code:

function [Axy,Ayz,Axz,Vxyz]=cube(x,y,z)
Axy=x*y
Ayz=y*z
Axz=x*z
Vxyz=x*y*z
clc
clear all
x=12
y=5

Page 133 of 161


STRUCTURAL ENGINEERING LAB

z=13
[Axy,Ayz,Axz,Vxyz]=cube(x,y,z)

Results:

Job 04: Find out the Volume and areas of all sides of the cube:

MATLAB Code:
function [Axy,Ayz,Axz,Vxyz]=cube(x,y,z)
Axy=x*y
Ayz=y*z
Axz=x*z
Vxyz=x*y*z
clc
clear all
x=15
y=7
z=19

Page 134 of 161


STRUCTURAL ENGINEERING LAB

[Axy,Ayz,Axz,Vxyz]=cube(x,y,z)

Results:

Job 05: Find out the Volume and areas of all sides of the cube:

MATLAB Code:
function [Axy,Ayz,Axz,Vxyz]=cube(x,y,z)
Axy=x*y
Ayz=y*z
Axz=x*z
Vxyz=x*y*z
clc
clear all
x=11
y=22

Page 135 of 161


STRUCTURAL ENGINEERING LAB

z=33
[Axy,Ayz,Axz,Vxyz]=cube(x,y,z)

Results:

Stiffness Matrix

Job 01: Draw an Element Stiffness Matrix:

MATLAB Code:
function [lm,ls,L,K]=Stiffness(x1,x2,y1,y2,A,E)
L=sqrt((x2-x1)^2-(y2-y1)^2);
ls=(x2-x1)/L;
lm=(y2-y1)/L;
K=E*A/L*[ls^2,ls*lm,-ls^2,-ls*lm;ls*lm,lm^2,-ls*lm,-lm^2;-ls^2,-
ls*lm,ls^2,ls*lm;-ls*lm,-lm^2,ls*lm,lm^2]

Page 136 of 161


STRUCTURAL ENGINEERING LAB

clc
clear all
x1=0
y1=0
x2=10
y2=8
A=2/12^2
E=29000*12^2
[lm,ls,L,K]=Stiffness(x1,x2,y1,y2,A,E)

Results:

Job 02: Draw an Element Stiffness Matrix:

MATLAB Code:

function [lm,ls,L,K]=Stiffness(x1,x2,y1,y2,A,E)
L=sqrt((x2-x1)^2-(y2-y1)^2);
ls=(x2-x1)/L;
lm=(y2-y1)/L;
K=E*A/L*[ls^2,ls*lm,-ls^2,-ls*lm;ls*lm,lm^2,-ls*lm,-lm^2;-ls^2,-
ls*lm,ls^2,ls*lm;-ls*lm,-lm^2,ls*lm,lm^2]
clc

Page 137 of 161


STRUCTURAL ENGINEERING LAB

clear all
x1=0
y1=0
x2=8
y2=0
A=2/12^2
E=29000*12^2
[lm,ls,L,K]=Stiffness(x1,x2,y1,y2,A,E)

Results:

Exercise No 07

Job 01: Write down the stiffness of the members of the truss.

MATLAB Code:

function K=StiffnesselementSA(coord,e,a)
x1=coord(1,1)
y1=coord(1,2)
x2=coord(2,1)

Page 138 of 161


STRUCTURAL ENGINEERING LAB

y2=coord(2,2)
l=sqrt((x2-x1)^2+(y2-y1)^2)
ls=(x2-x1)/l
lm=(y2-y1)/l
K=e*a/l*[ls^2,ls*lm,-ls^2,-ls*lm;ls*lm,lm^2,-ls*lm,-lm^2;-ls^2,
ls*lm,ls^2,ls*lm;-ls*lm,-lm^2,ls*lm,lm^2]
clc
clear all
coord1=[0 0;8 18]
e1=29000*12^2
a1=2/12^2
K1=StiffnesselementSA(coord1,e1,a1)
coord2=[8 18;16 18]
e1=29000*12^2
a1=2/12^2
K2=StiffnesselementSA(coord2,e1,a1)
coord3=[16 18;24 18]
e1=29000*12^2
a1=2/12^2
K3=StiffnesselementSA(coord3,e1,a1)
coord4=[0 0;8 6]
e1=29000*12^2
a1=2/12^2
K4=StiffnesselementSA(coord4,e1,a1)
coord5=[8 6;16 12]
e1=29000*12^2
a1=2/12^2
K5=StiffnesselementSA(coord5,e1,a1)
coord6=[16 12;24 18]
e1=29000*12^2
a1=2/12^2
K6=StiffnesselementSA(coord6,e1,a1)
coord7=[8 6;8 18]
e2=29000*12^2
a2=1/12^2
K7=StiffnesselementSA(coord7,e2,a2)
coord8=[8 18;16 12]
e2=29000*12^2
a2=1/12^2
K8=StiffnesselementSA(coord8,e2,a2)
coord9=[16 12;16 18]
e2=29000*12^2
a2=1/12^2
K9=StiffnesselementSA(coord9,e2,a2)

Results:

Page 139 of 161


STRUCTURAL ENGINEERING LAB

Page 140 of 161


STRUCTURAL ENGINEERING LAB

Page 141 of 161


STRUCTURAL ENGINEERING LAB

Exercise No 08

Job 01: Develop the Global Stiffness Matrix.

MATLAB Code:

clc
clear all
K=zeros(6,6)
k1=[0.33,0,-0.33,0;0,0,0,0;-0.33,0,0.33,0;0,0,0,0]
k2=[0.072,0.096,-0.072,-0.096;0.096,0.128,-0.096,-0.128;-0.072,-
0.096,0.072,0.096;-0.096,-0.128,0.096,0.128]
lm=[1,2,3,4]
ln=[1,2,5,6]
K(lm,lm)=K(lm,lm)+k1
K(ln,ln)=K(ln,ln)+k2

Results:

Page 142 of 161


STRUCTURAL ENGINEERING LAB

Page 143 of 161


STRUCTURAL ENGINEERING LAB

Job 02: Develop the Global Stiffness Matrix.

MATLAB Code:

clc
clear all
K1=zeros(6,6)
e=1
a=1
coord=[3,4;0,0;3,0] lmm=[1,2,3,4;1,2,5,6] conn=[2,3;1,2]
for i=1:2
con=conn(i,:)
coo=coord(con,:)
k=StiffnesselementSA(coo,e,a)
lm=lmm(i,:)
K(lm,lm)=K(lm,lm)+k
end

Results:

Page 144 of 161


STRUCTURAL ENGINEERING LAB

Page 145 of 161


STRUCTURAL ENGINEERING LAB

Page 146 of 161


STRUCTURAL ENGINEERING LAB

Page 147 of 161


STRUCTURAL ENGINEERING LAB

Page 148 of 161


STRUCTURAL ENGINEERING LAB

Job 03: Develop the Global Stiffness Matrix.

MATLAB Code:

clc
clear all
K1=zeros(10,10)
e=1
a=1
coord=[0,0;0,3;4,0;4,3;8,3]
lmm=[1,2,3,4;3,4,7,8;3,4,5,6;1,2,5,6;5,6,7,8;5,6,9,10;7,8,9,10]
conn=[1,2;2,4;2,3;1,3;3,4;3,4;4,5]
for i=1:7
con=conn(i,:)
coo=coord(con,:)
K=StiffnesselementSA(coo,e,a)
lm=lmm(i,:)
K1(lm,lm)=K1(lm,lm)+K
End

Results:

Job 04: Draw the global stiffness matrix:

MATLAB Code:

clc
clear all
K1=zeros(8,8)
e=1
a=1
coord=[0,0;0,10;10,10;10,0]
lmm=[1,2,3,4;3,4,5,6;1,2,7,8;7,8,5,6;5,6,1,2;3,4,7,8]
conn=[1,2;2,3;1,4;4,3;3,1;2,4]
for i=1:6
con=conn(i,:)
coo=coord(con,:)
K=StiffnesselementSA(coo,e,a)
lm=lmm(i,:)
K1(lm,lm)=K1(lm,lm)+K
End

Page 149 of 161


STRUCTURAL ENGINEERING LAB

Results:

Page 150 of 161


STRUCTURAL ENGINEERING LAB

Exercise No 09

Task: Calculate the unknown displacement and forces by MATLAB.

MTLAB Code:

function K=StiffnesselementSA(coord,e,a)
x1=coord(1,1)
y1=coord(1,2)
x2=coord(2,1)
y2=coord(2,2)
l=sqrt((x2-x1)^2+(y2-y1)^2)
ls=(x2-x1)/l
lm=(y2-y1)/l
K=e*a/l*[ls^2,ls*lm,-ls^2,-ls*lm;ls*lm,lm^2,-ls*lm,-lm^2;-ls^2,
ls*lm,ls^2,ls*lm;-ls*lm,-lm^2,ls*lm,lm^2]

function [Du,Fu]=Shahzaib(K1,F,KDOF,KLOF)
A=size(F)
UDOF=setdiff(1:A,KLOF)
Fk=F(UDOF,:)
K11=K(UDOF,UDOF)
K12=K(UDOF,KLOF)
K21=K(KLOF,UDOF)
K22=K(KLOF,KLOF)
Du=inv(K11)*Fk
Fu=K11*Du
Fu=K21*Du

clc
clear all
K1=zeros(12,12)
e=1
a=1
Elements=9
coord=[0,0;3,3;6,3;9,3;6,-2;3,0]
lmm=[1,2,3,4;3,4,5,6;5,6,7,8;9,10,7,8;1,2,9,10;1,2,11,12;11,12,3,4;11,12,5,
6;9,10,5,6]
conn=[1,2;2,3;3,4;5,4;1,5;1,6;6,2;6,3;5,3]
for i=1:Elements
con=conn(i,:)
coo=coord(con,:)
K=StiffnesselementSA(coo,e,a)
lm=lmm(i,:)
K1(lm,lm)=K1(lm,lm)+K
end

F=zeros(12,1)
F(2)=-25
F(4)=-4
KLOF=[7;8;10]
KDOF=[0;0;0]
[Du,Fu]=Shahzaib(K1,F,KDOF,KLOF)

Page 151 of 161


STRUCTURAL ENGINEERING LAB

Results:

Page 152 of 161


STRUCTURAL ENGINEERING LAB

Page 153 of 161


STRUCTURAL ENGINEERING LAB

Page 154 of 161


STRUCTURAL ENGINEERING LAB

Exercise N0 10
Task: Determine the member forces of following truss for different values of E and A by
MATLAB.

MATLAB Code:

function [k]=StifnesselementSA(coord,e,a)
x1=coord(1,1)
y1=coord(1,2)
x2=coord(2,1)
y2=coord(2,2)
l=sqrt((x2-x1)^2+(y2-y1)^2)
ls=(x2-x1)/l
lm=(y2-y1)/l
k=e*a/l*[ls^2,ls*lm,-ls^2,-ls*lm;ls*lm,lm^2,-ls*lm,-lm^2;-ls^2,-
ls*lm,ls^2,ls*lm;-ls*lm,-lm^2,ls*lm,lm^2]

function[Du,Fu,UDOF]=Shahzaib(K,F,KDOF,KLOF)
A=size(F);
UDOF=setdiff(1:A,KLOF);
Fk=F(UDOF,:);
K11=K(UDOF,UDOF);
K12=K(UDOF,KLOF);\
K21=K(KLOF,UDOF);
K22=K(KLOF,KLOF);
Dk=KDOF;
Du=inv(K11)*Fk;
Fk=K11*Du+K12*Dk;
Fu=K21*Du;
end

Page 155 of 161


STRUCTURAL ENGINEERING LAB

function [B]=Shahzaib(coord,e,a)
x1=coord(1,1)
y1=coord(1,2)
x2=coord(2,1)
y2=coord(2,2)
l=sqrt((x2-x1)^2+(y2-y1)^2)
ls=(x2-x1)/l
lm=(y2-y1)/l
B=e*a/l*[1 -1;-1 1]*[ls lm 0 0;0 0 ls lm];

clc
clear all
e1=0.0015
a1=2e1+11
e2=0.001
a2=1.8e2+11
K=zeros(12,12);
coord=[0 0;3 3;6 3;9 3;6 -2;3 0];
lmn=[1,2,3,4;3,4,5,6;5,6,7,8;7,8,9,10;1,2,9,10;1,2,11,12;3,4,11,12;5,6,11,1
2;5,6,9,10];
conn=[1,2;2,3;3,4;4,5;1,5;1,6;2,6;3,6;3,5];
for i=1:5
con=conn(i,:);
coo=coord(con,:);
[k]=StifnesselementSA(coo,e1,a1);
lm=lmn(i,:);
K(lm,lm)=K(lm,lm)+k;
End
for i=6:9
con=conn(i,:);
coo=coord(con,:);
[k]=StifnesselementSA(coo,e2,a2);
lm=lmn(i,:);
K(lm,lm)=K(lm,lm)+k;
end

F=zeros(12,1);
F(2)=-25;
F(4)=-12.5;
KLOF=[7;8;10];
KDOF=[0;0;0];
[Du,Fu,UDOF]=Shahzaib(K,F,KDOF,KLOF)
D=zeros(12,1);
D(UDOF,1)=Du;
D(KLOF,1)=KDOF

for i=1:5
con=conn(i,:);
coo=coord(con,:);
[B]=Shahzaib1(coo,e1,a1);
lm=lmn(i,:);
Forces_M=B*D(lm)
end
for i=6:9
con=conn(i,:);
coo=coord(con,:);
[B]=Shahzaib1(coo,e2,a2);
lm=lmn(i,:);
Forces_M=B*D(lm)
end

Page 156 of 161


STRUCTURAL ENGINEERING LAB

Results:

Page 157 of 161


STRUCTURAL ENGINEERING LAB

Page 158 of 161


STRUCTURAL ENGINEERING LAB

Page 159 of 161


STRUCTURAL ENGINEERING LAB

Page 160 of 161


STRUCTURAL ENGINEERING LAB

Page 161 of 161

You might also like