Test Question

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

COMPUTER PROGRAMMING

SEAA2413, SKAB2413, SKAA3413

TEST 1 AND TEST 2


Q1: Write a program to calculate the support reac�ons and bending moment at any point on
a simply supported beam as shown in the figure 1(a) below. The algorithm is provided in
Figure 1(b). The program must incorporate the facili�es below:
i) The usage of selec�on statement to calculate moment
ii) Valida�on check for input existence
iii) Valida�on check to make sure (a+b) > x, (a+b) > a and (a+b)> b
(10 Marks)

The example of output is shown in Figure 1(c)

Figure 1(a)
Algorithm

1. Inputs: a, b, P, G and X
2. Calculate RA and RB
𝑏𝑏2
𝑃𝑃(𝑎𝑎)+𝑔𝑔( )
RA = 𝑎𝑎+𝑏𝑏
2

RB = 𝑃𝑃 − 𝑅𝑅𝑅𝑅

3. Calculate moment

𝐹𝐹𝐹𝐹𝐹𝐹 𝑥𝑥 ≤ 𝑎𝑎

𝑀𝑀𝑀𝑀 = 𝑅𝑅𝑅𝑅(𝑥𝑥)

𝐹𝐹𝐹𝐹𝐹𝐹 𝑥𝑥 > 𝑎𝑎

𝑥𝑥−𝑎𝑎
𝑀𝑀𝑀𝑀 = 𝑅𝑅𝑅𝑅(𝑥𝑥) − 𝐺𝐺(𝑥𝑥 − 𝑎𝑎)( 2
)

4. Print RA, RB and Mx

Figure 1(b)

Please insert distance a (meter)= 3

Please insert distance b (meter)= 4

Please insert point load P (meter)= 10

Please uniform distributed load G(kN/m)= 3

Please insert the distance for moment point (meter) = 4

Moment at X = 4.00 meter from RA is 204.50 kNm

Figure 1(c)
Q2: Figure Q2(a) below shows a determinate overhang beam. One (1) unit of moving load is
applied to the beam as shown in the figure, where x is the distance from support A to
the load.

x 1

A B

L1 L2

Figure 2(a)

a) Construct a MATLAB program to calculate the reactions at A and B due to the moving
unit load (i.e. the influence lines). The reactions of A and B when the load is at any
point x are calculated based on the formulae below.
𝑥𝑥
Reac�on at A (Ay) = 1− 𝐿𝐿1
(Eqn. 1)
𝑥𝑥
Reac�on at B (By) = 𝐿𝐿1
(Eqn. 2)

The output of the program is shown in Figure Q2(b). The program must include the
facili�es below:

i) User input of L1 and L2.


ii) Data validation to check that the input are positive and L1 > L2.
iii) Calculate the reactions of supports A and B at every 1m load distance (use
the variables in the Eqn. 1 and Eqn. 2) using while loop.
iv) User Defined Function (UDF) for calculation in iii)
(30 Marks)

Figure 2(b)

You might also like