Sunteți pe pagina 1din 10

SKAA 3413 TEST 1 (30%) SEM 01-2016/17

Q1 a) Please answer the following questions.

i) Explain the two most important steps of Program Development Cycle (PDC)
that are used in translating a given problem into a program code.

ii) If a = [3 6 8;11 4 5], state whether each of the following statements is valid or
invalid.
MATLAB
Valid/Invalid
Statement
a(1,2) = [ ]
a(1,2) = 2

iii) What is the use of the Editor Window and Figure Window in MATLAB?

iv) How can we clear the content of the Command Window and Workspace
Window?

(8 marks)

2
SKAA 3413 TEST 1 (30%) SEM 01-2016/17

b) Please answer the following questions:

Question Answer

i) Using colon operator, create matrix A


consisting of the following elements: A =

3 4 5 6
15 30 45 60
40 30 20 10
B =
and then create matrix B from matrix A as
shown below:

40 30 45 60

ii) Write the value of matrix C for the following C =


statements:

A = 2*(linspace(2,5,4))
A(2,1:end) = [5:2:12]
C = A./2

iii) Provide the value of D for the following D =


statements

A = [10 -32 50;6 20 -40; 8 4 1]


B = [2 4 5]
D = [(3*B)' A(1:end,2)]

(10 marks)

3
SKAA 3413 TEST 1 (30%) SEM 01-2016/17

c) Please write the scripts for the algorithms below:

Algorithm Script

i) Given variables r = [10 20 30],


b = [25 50 75], h = [50 100 150] and
π = 3.14, calculate the moment of
inertia for a composite Ix using the
following equation:

ii) Create matrix X with the appropriate


value of π to 2π radian with the interval
of π/10.

Calculate y and dy based on the


equations below:

Calculate the mean value of y.

Plot both functions (y and dy) versus x


on the same axes.

(12 marks)

4
SKAA 3413 TEST 1 (30%) SEM 01-2016/17

Q2 a) Figure Q2(a) shows a simple truss ABC which is loaded by 10 kN force as shown.
A set of linear equations obtained from the joint equilibrium for the system is as
listed in Figure Q2(b), where f1 - f6 are reactions and member internal forces as
shown by the circle in Figure Q2(a). These equations can be solved using
MATLAB by creating relevant arrays and applying WX=Y, where W is a square
matrix and X and Y are column vectors.

f1 =0
f2 + f3 =0
-f3 - 0.6f4 = 0
-0.8f4 – 10 = 0
0.6f4 + f6 =0
0.8f4 + f5 = 0

Figure Q2(a) Figure Q2(b)

(i) Write the content of arrays W, X and Y in the space provided below.
(7 marks)

W= X= Y=

(ii) Write MATLAB statements to create matrix W, vector Y and an expression to


solve X.
(3 marks)
W = _______________________________________________________________
Y = ________________________________________________________________
X = ________________________________________________________________

b) If the size of matrix M is 6 x 100, write MATLAB statement to:


(6 marks)
(i) Add the second and third rows of M and store in P. P= _____________________
(ii) Delete the first row of M. ___________________________
(iii)Add a new last row to M such that all are 1’s. ___________________________
(iv)Delete the entire columns 10 to 20 of M. ___________________________
(v) Determine the size of M? ___________________________

5
SKAA 3413 TEST 1 (30%) SEM 01-2016/17

c) Table Q2(a) shows a MATLAB script.

Table Q2(a)
1 f=[400 200];
2 a=[60 30];
3 fx=f.*cosd(a);
4 fy=f.*sind(a);
5 tfx=sum(fx);
6 tfy=sum(fy);
7 fr=sqrt(tfx^2+tfy^2);
8 frang=atand(tfy/tfx);
9 mat=[f;a;fx;fy];
10 disp('SUMMARY')
11 fprintf('Force Angle Fx Fy\n')
12 fprintf('%6.2f\t%6.2f\t%6.2f\t%6.2f\n',mat)
13 fprintf('Total Fx is '),fprintf('%.1f',tfx)
14 fprintf('Total Fy is '),fprintf('%.1f',tfy)
15 fprintf('\n\nThe FR is %5.1f KN\n at %4.1f deg.\n',fr,frang)

If the script is executed;


(i) Write down the return values for the following variables:
(6 marks)
fx = _________________________________________________________
fy = _________________________________________________________
tfx = _________________________________________________________
tfy = _________________________________________________________
fr = _________________________________________________________
frang = ________________________________________________________

6
SKAA 3413 TEST 1 (30%) SEM 01-2016/17

(ii) Write down in the box below what would be displayed by statement lines 10-
15.
(6 marks)

(iii) Replace statement lines 11-15 of Table Q2(a), so that it would display the
result as shown in Table Q2(b) in the box below.
(6 marks)

11
12
..
..
..
..
..
..

Table Q2(b)
Force   Note:
Angle    ‘s,  ‘s,  ‘s and  ‘s are
Comp.Fx   the numerical content of
Comp.Fy   vectors f, a, fx and fy,
respectively.
The resultant is  at  radians  and  are the numerical
values of variables fr and
frang.

7
SKAA 3413 TEST 1 (30%) SEM 01-2016/17

d) Table Q2(c) below shows a MATLAB scripts. If the script is executed:


i) Fill in spaces provided with he current values of variables, and
ii) If Table Q2(d) represents the Command Window, write down what would be
displayed.

The initial variable values are listed below:


w= 220; c = 20; A = 2500; d = 25
(10 marks)
Table Q2(c)
Variable Variable
MATLAB SCRIPT
name value
teks='GOOD TRY' teks=
smax=4*d smax=

n=round(4*A/pi/d^2) n=
z=n*d z=
s=round((w-2*c-z)/(n-1)) s=
if s>d && s<smax ans=
disp('SPACING IS OK') {write executed disp
fprintf('No. of bars is %d.\n',n) and fprintf functions
fprintf('Bar spacing is %3d mm.\nBar size %2d\n',s,d) in TableQ2(d)}

else
if s<d ans=
disp('SPACING TOO CLOSE')
fprintf('Spacing = %3d mm.: For %2d mm bar\n',s,d)
{write executed disp
disp('PLEASE INCREASE ''D''')
and fprintf functions
else in TableQ2(d)
disp('SPACING TOO BIG'),disp('PLEASE DECREASE ''D''')
fprintf('For %2d mm bar the spacing is %3d mm.\n',d,s)
end
disp('Please re-run with revised diameter')
end
disp(teks)

Table Q2(d)

8
SKAA 3413 TEST 1 (30%) SEM 01-2016/17

Q3 The cantilever retaining wall shown in Figure Q3(a) is backfilled with granular material
having a unit weight, ρ = 19kNm-3 and an internal angle of friction, ϕ = 30o. Assuming
the coefficient of friction, µ = 0.4 and the unit weight of concrete, ρconc = 24kNm-3,
write a MATLAB script to determine the factors of safety against sliding and
overturning.

Note: hw
h = hw + hb h
a = bb-bs-bw
hs = hw

hb

a bw bs Pa

bb

Figure Q3(a)

Table Q3(a) – Sample Output


Please enter the height of wall, hw (m): 5
Please enter the thickness of wall, bw (m): 0.4
Please enter the width of base, bb (m): 4 Input by
Please enter the height of base, hb (m): 0.4 user
Please enter the width of soil, bs (m): 2.9

The factor of safety against sliding, FSs is 1.57


OK. The wall is safe against sliding. Displayed
The factor of safety against overturning, FSov is 4.95 Output
OK. The wall is safe against overturning.

The steps listed in Table Q3(b) may be used to write the program.

Table Q3(b)
1. Input the dimensions of the cantilever retaining wall and backfill.
2. Assign the other variables.
1  sin 
3. Calculate the coefficient of active pressure, ka 
1  sin 
4. Calculate the active pressure, Pa  ka h

9
SKAA 3413 TEST 1 (30%) SEM 01-2016/17

5. Calculate the horizontal force on wall due to backfill, Fa  0.5 Pa h


6. Calculate the total vertical force, Wt by summing up the weight of wall, base and backfill
soil, i.e. Ww  hwbw  conc Wb  h b bb  conc Ws  h s bs 
7. Calculate the friction force, Ff  Wt
8. Assuming passive pressure force, Fp = 0, determine the factor of safety against sliding,
FSs  Ff / Fa
9. Taking moments about point A, calculate the sum of overturning moments, M ov  Fa h / 3
10. Calculate the sum of restoring moments,
M res  Ww (0.5bw  a )  Wb (0.5bb )  Ws (0.5bs  bw  a )
11. Determine the factor of safety against overturning, FSov = Mres/Mov
12. Check if the wall is safe against sliding and overturning, i.e. FSs > 1.5 and FSov > 2.0
13. Display the output in the format as shown in Table Q3(a).

Answer for Q3
clc, clear

%Input dimensions of retaining wall

%Completing the other dimensions (wall, base and soil)

%Assigning values into variables

10
SKAA 3413 TEST 1 (30%) SEM 01-2016/17

Answer for Q3 (cont’d)


%Calculations

%Display results

(30 marks)

11

S-ar putea să vă placă și