Sei sulla pagina 1di 4

FCM2043/FDM2043 - COMPUTATIONAL METHODS

JANUARY 2016 SEMESTER


MATLAB ASSIGNMENT/TEST QUESTIONS

Q1.

Develop an M-file to implement the bisection method. Using this program solve
the following problem.
The velocity of falling parachutist is given as
gm
v(t )
(1 e ( c / m)t ) .
c
Where v(t ) = velocity of parachutist = 40 m / s ,
g = gravitational constant = 9.8 m / s 2 ,
m = the mass of the parachutist = 68.1 kg .
Find the drag coefficient, c at the time t 10 seconds using the initial bracket of
the root as [13, 16] and iterate until a 0.001 %.

Q2.

Develop an M-file to implement the false-position method. Using this program


solve the following problem.
The velocity of falling parachutist is given as
gm
v(t )
(1 e ( c / m)t ) .
c
Where v(t ) = velocity of parachutist = 40 m / s ,
g = gravitational constant = 9.8 m / s 2 ,
m = the mass of the parachutist = 68.1 kg .
Find the drag coefficient, c at the time t 10 seconds using the initial bracket of
the root as [13, 16] and iterate until a 0.001 %.

Q3.

Locate the root of f ( x) 2 sin( x) x


(a)
Using the MATLAB function fzero with an initial guess of
x0 2 .
(b)
Using Newton-Raphson method by writing a function M-file. Use an
initial guess of x0 0.5 and iterate until a 0.001 %.

Q4.

Develop an M-file to implement the modified secant method. Using this program
determine the loest positive root of f ( x) 8 sin( x) e x 1 with an initial guess of
x0 0.3 and 0.01. Iterate until a 0.000001% .

Q5.

Find the solution of the following set of linear algebraic equations


x 2 y 3z 1
3x 3 y 4 z 1
2 x 3 y 3z 2

(a)

Using the left-division \.

(b)

Using Gaussian elimination.

(c)

Using the LU decomposition.


[Hint: Since [LU]x = b, let [U]x = y, so that [L]y = b. Now, first solve for
y and then for x.]

Q6.

Develop a function M-file Tridiag.m to solve the following tridiagonal system


with the Thomas algorithm.
f1
e
2

g1
f2
e3

g2
f3
.

g3
.
.

.
.

e n 1

f n 1
en

x1 r1
x r
2 2
x3 r3

. .
. .

. .
g n 1 x n 1 rn 1

f n x n rn

Thomas Algorithm:
(i)
Decomposition:
e
ek k and
f k 1
f k f k ek . g k 1 , where k 2,3,4, , n .
(ii)
Forward substitution:
rk rk ek . rk 1 , where k 2,3,4, , n .
(iii)
Back substitution:
r
xn n
fn
(r g k . x k 1 )
and x k k
, where k n 1, n 2, ,2,1 .
fk
Using your program, solve the following tridiagonal system.
0.020875
2.01475
x1 4.175
0.020875
x 0
2.01475
0.020875

2 =

0.020875
2.01475
0.020875 x 3 0

0.020875
2.01475 x 4 2.0875

Q7.

Develop a MATLAB script file to determine the solution of the following system
of linear equations using the Gauss-Seidel iteration method by performing first
seven iterations.
9 x1 2 x 2 3x3 2 x 4 54.5
2 x1 8 x 2 2 x3 3 x 4 14
3 x1 2 x 2 11x3 4 x 4 12.5
2 x1 3 x 2 2 x3 10 x 4 21

Q8.

Develop a script M-file to estimate f (2.75) using Lagrange interpolating


polynomials of order 1, 2 and 3 for the following data.
x
f(x)

0
0

1
0.5

2
0.8

3
0.9

4
0.941176

5
0.961538

For each estimate find the true percent relative error if the try function is given by
x2
.
f ( x)
(1 x 2 )
Q9.

The force on a sailboat mast can be represented by the following function:


H
z 2.5 z / H
F 200
dz
e
0
7 z

where z the elevation above the deck and H the height of the mast. Compute
F for the case where H 30 using
(i)

the M-file for Trapezoidal rule with the step size h 0.1 .

the MATLAB trapz function.

Q10. Develop an M-file to implement Simpsons 1/3 rule. Using your program solve
the following problem.
The velocity of falling parachutist is given as
gm
v(t )
(1 e ( c / m)t ) .
c
Where v(t ) = velocity of parachutist,
g = gravitational constant = 9.81m / s 2 ,
m = mass of the parachutist = 45 kg ,
c = the drag coefficient = 32.5 kg / s .
If the distance, d, traveled by the parachutist is given by

d v(t )dt ,
0

find the distance using Simpsons 1/3 rule for the segments 10, 20, 50, and 100.
Q11. Develop an M-file for Eulers method to solve a first order ordinary differential
equation (ODE).

i(t)
E

The current around the circuit at time t is governed by the following differential
equation
3

di
2i 3e 2t ,
dt

i(0) 2 .

Using your program, solve the above initial value problem over the interval from
t 0 to 2 with the step size h 0.1 .
Q12. Develop an M-file for Fourth-Order Runge-Kutta method to solve a first order
ordinary differential equation (ODE).
Using your program solve the following initial value problem over the interval
from x 0 to 2 with the step size h 0.2 .
dy
x2 y ,
y(0) 0.8 .
dx

Potrebbero piacerti anche