matlab assignment and test questions - may 2013 sem

Upload: vikri-januarisma

Post on 03-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/28/2019 Matlab Assignment and Test Questions - May 2013 Sem

    1/4

    FCM2043/EBB2143 - COMPUTATIONAL METHODSMAY 2013 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()()/( tmce

    c

    gmtv = .

    Where )(tv = velocity of parachutist = sm /40 ,g= gravitational constant =

    2/8.9 sm ,m = the mass of the parachutist = kg1.68 .

    Find the drag coefficient, c at the time 10=t seconds using the initial bracket ofthe root as [13, 16] and iterate until 001.0a %.

    Q2. Develop an M-file to implement the falseposition method. Using this programsolve the following problem.

    The velocity of falling parachutist is given as

    )1()()/( tmce

    c

    gmtv = .

    Where )(tv = velocity of parachutist = sm /40 ,g= gravitational constant = 2/8.9 sm ,

    m = the mass of the parachutist = kg1.68 .Find the drag coefficient, c at the time 10=t seconds using the initial bracket ofthe root as [13, 16] and iterate until 001.0a %.

    Q3. Locate the root of xxxf = )sin(2)(

    (a) Using the MATLAB function fzero with an initial guess of20 =x .

    (b) Using Newton-Raphson method by writing a function M-file. Use an

    initial guess of 5.00 =x and iterate until 001.0a %.

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

    determine the loest positive root of 1)sin(8)( = xexxf with an initial guess

    of 3.00 =x and 01.0= . Iterate until %000001.0=a .

    Q5. Find the solution of the following set of linear algebraic equations

  • 7/28/2019 Matlab Assignment and Test Questions - May 2013 Sem

    2/4

    2332

    1433

    132

    =++

    =++

    =++

    zyx

    zyx

    zyx

    (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 fory and then forx.]

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

    =

    n

    n

    n

    n

    nn

    nnn

    r

    r

    r

    r

    r

    x

    x

    x

    x

    x

    fe

    gfe

    gfe

    gfe

    gf

    1

    3

    2

    1

    1

    3

    2

    1

    111

    333

    222

    11

    .

    .

    .

    .

    .

    .

    ...

    ......

    Thomas Algorithm:(i) Decomposition:

    1

    =k

    k

    kf

    ee and

    1. = kkkk geff , where nk ,,4,3,2 = .(ii) Forward substitution:

    1. = kkkk rerr , where nk ,,4,3,2 = .(iii) Back substitution:

    n

    nn

    f

    rx =

    andk

    kkkk

    f

    xgrx

    ).( 1+= , where 1,2,,2,1 = nnk .

    Using your program, solve the following tridiagonal system.

    01475.2020875.0

    020875.001475.2020875.0020875.001475.2020875.0

    020875.001475.2

    4

    3

    2

    1

    x

    xx

    x

    =

    0875.2

    00

    175.4

    Q7. Develop a MATLAB script file to determine the solution of the following systemof linear equations using the Gauss-Seidel iteration method by performing first

    seven iterations.

  • 7/28/2019 Matlab Assignment and Test Questions - May 2013 Sem

    3/4

    2110232

    5.1241123

    143282

    5.542329

    4321

    4321

    4321

    4321

    =+++

    =++

    =++

    =++

    xxxx

    xxxx

    xxxx

    xxxx

    Q8. Develop a script M-file to estimate )75.2(f using Lagrange interpolating

    polynomials of order 1, 2 and 3 for the following data.

    x 0 1 2 3 4 5

    f(x

    )

    0 0.5 0.8 0.9 0.941176 0.961538

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

    )1()(

    2

    2

    x

    xxf

    += .

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

    +=

    HHzdze

    z

    zF

    0

    /5.2

    7200

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

    (i) the M-file for Trapezoidal rule with the step size 1.0=h .

    the MATLAB trapz function.

    Q10. Develop an M-file to implement Simpsons 1/3 rule. Using your program solvethe following problem.

    The velocity of falling parachutist is given as

    )1()( )/( tmcec

    gmtv = .

    Where )(tv = velocity of parachutist,g= gravitational constant =

    2/8.9 sm ,

    m = mass of the parachutist = kg45 ,c = the drag coefficient = skg/5.32 .If the distance, d, traveled by the parachutist is given by

    =6

    0

    )( dttvd ,

    find the distance using Simpsons 1/3 rule for the segments 10, 20, 50, and 100.

  • 7/28/2019 Matlab Assignment and Test Questions - May 2013 Sem

    4/4

    Q11. Develop an M-file for Eulers method to solve a first order ordinary differentialequation (ODE).

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

    teidt

    di 2323 += , 2)0( =i .

    Using your program, solve the above initial value problem over the interval from0=t to 2 with the step size 1.0=h .

    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 0=x to 2 with the step size 2.0=h .

    8.0)0(,2

    =+= yyxdx

    dy.

    i(t)

    E