4
8/20/2019 UTP CM Matlab Assignment and Test Questions - May 2015 Sem http://slidepdf.com/reader/full/utp-cm-matlab-assignment-and-test-questions-may-2015-sem 1/4  FCM2043/FDM2043 - COMPUTATIONAL METHODS JANUARY 2015 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 ) 1 ( ) (  ) (  m c e c  gm v  = . !here ) (v " velocity of parachutist "  s m #$ %  g " gravitational constant " & ' . (  s m % m " the mass of the parachutist " kg 1 . ' . *ind the drag coefficient% c at the time 1$ =  seconds using the initial brac+et of the root as ,1% 1 and iterate until $$1 . $ a ε /. Q2. Develop an M-file to implement the falseposition method. Using this program solve the following problem. The velocity of falling parachutist is given as ) 1 ( ) (  ) (  m c e c  gm v  = . !here ) (v " velocity of parachutist "  s m #$ %  g " gravitational constant " & ' . (  s m % m " the mass of the parachutist " kg 1 . ' . *ind the drag coefficient% c at the time 1$ =  seconds using the initial brac+et of the root as ,1% 1 and iterate until $$1 . $ a ε /. Q3. 0ocate the root of  x  x  x   f  =  ) sin( & ) (  (a) Using the MT02 function fzero with an initial guess of  & $  =  x . (b) Using 3ewton-4aphson method by writing a function M-file. Use an initial guess of 5 . $ $  =  x  and iterate until $$1 . $ a ε /. Q4. Develop an M-file to implement the modified secant method. Using this program determine the loest positive root of 1 ) sin( ' ) (  =   x e  x  x   f  with an initial guess of - . $ $  =  x  and $1 . $ = δ . 6terate until  / $$$$$1 . $ = a ε . Q5. *ind the solution of the following set of linear algebraic e7uations

UTP CM Matlab Assignment and Test Questions - May 2015 Sem

Embed Size (px)

Citation preview

Page 1: UTP CM Matlab Assignment and Test Questions - May 2015 Sem

8/20/2019 UTP CM Matlab Assignment and Test Questions - May 2015 Sem

http://slidepdf.com/reader/full/utp-cm-matlab-assignment-and-test-questions-may-2015-sem 1/4

 

FCM2043/FDM2043 - COMPUTATIONAL METHODS

JANUARY 2015 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

)1()(   )(   t mcec

 gmt v   −−= .

!here )(t v " velocity of parachutist "  sm #$ % g " gravitational constant " &

'.(   sm %m " the mass of the parachutist " kg 1.' .

*ind the drag coefficient% c at the time 1$=t   seconds using the initial brac+et of

the root as ,1% 1 and iterate until $$1.$≤aε  /.

Q2. Develop an M-file to implement the falseposition method. Using this program

solve the following problem.

The velocity of falling parachutist is given as

)1()(   )(   t mcec

 gmt v   −−= .

!here )(t v " velocity of parachutist "  sm #$ % g " gravitational constant " &

'.(   sm %m

" the mass of the parachutist "kg 1.'

.*ind the drag coefficient% c at the time 1$=t   seconds using the initial brac+et of

the root as ,1% 1 and iterate until $$1.$≤aε  /.

Q3. 0ocate the root of  x x x  f     −=   )sin(&)(  

(a) Using the MT02 function fzero  with an initial guess of 

  &$   = x .

(b) Using 3ewton-4aphson method by writing a function M-file. Use an

initial guess of 5.$$  = x  and iterate until $$1.$≤aε  /.

Q4. Develop an M-file to implement the modified secant method. Using this program

determine the loest positive root of 1)sin(')(   −=   − xe x x  f    with an initial guess

of -.$$  = x  and $1.$=δ   . 6terate until   /$$$$$1.$=aε  .

Q5. *ind the solution of the following set of linear algebraic e7uations

Page 2: UTP CM Matlab Assignment and Test Questions - May 2015 Sem

8/20/2019 UTP CM Matlab Assignment and Test Questions - May 2015 Sem

http://slidepdf.com/reader/full/utp-cm-matlab-assignment-and-test-questions-may-2015-sem 2/4

&--&

1#--

1-&

=++

=++

=++

 z  y x

 z  y x

 z  y x

(a) Using the left-division 8.

(b) Using 9aussian elimination.

(c) Using the 0U decomposition.

,:int; <ince ,LUx " % let ,Ux " !% so that ,L! " . 3ow% first solve for ! and then for x.

Q"# Develop a function M-file Tridiag.m to solve the following tridiagonal systemwith the Thomas algorithm.

=

×

−−−−−

n

n

n

n

nn

nnn

 x

 x

 x

 x

 x

 f  e

 g  f  e

 g  f  e

 g  f  e

 g  f  

1

-

&

1

1

-

&

1

111

---

&&&

11

.

.

.

.

.

.

...

......

Thomas lgorithm;(i) Decomposition;

1−

=k 

k k 

 f  

ee  and

1. −−=   k k k k    g e  f    f   % where nk    %%#%-%&   −−−−−−= .(ii) *orward substitution;

1. −−=   k k k k    r er r  % where nk    %%#%-%&   −−−−−−= .(iii) 2ac+ substitution;

n

n

n f  

r  x   =  

andk 

k k k k 

 f  

 x g r  x

  ).( 1+−= % where 1%&%%&%1   −−−−−−=   nnk  .

Using your program% solve the following tridiagonal system.

 

−−−

−−

$1#=5.&$&$'=5.$

$&$'=5.$$1#=5.&$&$'=5.$$&$'=5.$$1#=5.&$&$'=5.$

$&$'=5.$$1#=5.&

×

#

&

1

 x

 x x

 x

"

$'=5.&

$$

1=5.#

Q$. Develop a MT02 script file to determine the solution of the following system

of linear e7uations using the 9auss-<eidel iteration method by performing first

seven iterations.

Page 3: UTP CM Matlab Assignment and Test Questions - May 2015 Sem

8/20/2019 UTP CM Matlab Assignment and Test Questions - May 2015 Sem

http://slidepdf.com/reader/full/utp-cm-matlab-assignment-and-test-questions-may-2015-sem 3/4

&11$&-&

5.1&#11&-

1#-&'&

5.5#&-&(

#-&1

#-&1

#-&1

#-&1

−=+++−

=−++−

−=+−+

=++−

 x x x x

 x x x x

 x x x x

 x x x x

Q%. Develop a script M-file to estimate )=5.&(  f     using 0agrange interpolating

 polynomials of order 1% & and for the following data.

 x $ 1 & # 5

 f  ( x) $ $.5 $.' $. $.#11= $.15'

*or each estimate find the true percent relative error if the try function is given by

)1()( &

&

 x x x f  += .

Q&. The force on a sailboat mast can be represented by the following function;

∫    −  

 

+=

  H  H  z dz e

 z 

 z  F 

$

5.&

=&$$

where = z  the elevation above the dec+ and = H  the height of the mast.>ompute  F   for the case where   -$= H   using

(i) the M-file for Trape?oidal rule with the step si?e 1.$=h .

the MATLAB trapz function.

Q10. Develop an M-file to implement <impson@s 1 rule. Using your program solvethe following problem.

The velocity of falling parachutist is given as

)1()(   )(   t mcec

 gmt v   −−= .

!here )(t v " velocity of parachutist% g " gravitational constant "

&'.(   sm %

m " mass of the parachutist " kg #5 %

c  " the drag coefficient "  skg 5.-& .6f the distance% d% traveled by the parachutist is given by

∫ =

$

)(   dt t vd  %

find the distance using <impson@s 1 rule for the segments 1$% &$% 5$% and 1$$.

Page 4: UTP CM Matlab Assignment and Test Questions - May 2015 Sem

8/20/2019 UTP CM Matlab Assignment and Test Questions - May 2015 Sem

http://slidepdf.com/reader/full/utp-cm-matlab-assignment-and-test-questions-may-2015-sem 4/4

Q11. Develop an M-file for Auler@s method to solve a first order ordinary differentiale7uation (BDA).

The current around the circuit at time t   is governed by the following differentiale7uation

t eidt 

di   &-&-   −+= % &)$(   =i .

Using your program% solve the above initial value problem over the interval from$=t   to & with the step si?e 1.$=h .

Q12. Develop an M-file for *ourth-Brder 4unge-Cutta method to solve a first order 

ordinary differential e7uation (BDA).Using your program solve the following initial value problem over the interval

from $= x  to & with the step si?e &.$=h .

'.$)$(%&

=+=   y y xdx

dy.

i(t )

 E