Sei sulla pagina 1di 3

MATLAB Programming for Numerical Computations Jan–March 2018

Pre-Assignment for the Course


No Deadline

• Part-1 of this assignment goes over some of the pre-requisites for this course
• Familiarity with first-year undergraduate Math is assumed
• Submission portal will be created only for Part-1
• Any prior programming experience is useful, but not required
• Part-2 is just “simple fun exercises” based on first two lectures of this

PART-1: NUMERICAL / MATH

The problems below test your knowledge about numerical techniques.


Only a general familiarity with the subject is needed. Students can feel free to do a Google
search or refer to undergraduate Math text to answer these questions. My other NPTEL course
on Computational Techniques ( http://nptel.ac.in/courses/103106074/ ) provides this
background; however, it is more detailed than required for this MATLAB course.

1. A general Taylor’s Series expansion is given by:


a. ℎ' ℎ*
𝑓 𝑎+ℎ =1+ℎ+ + +⋯
2! 3!

b. ℎ' ℎ*
𝑓 𝑎 + ℎ = 𝑓 𝑎 + ℎ𝑓 𝑎 + 𝑓 𝑎 + 𝑓 𝑎 +⋯
2! 3!

c. ℎ' --
-
ℎ* ---
𝑓 𝑎 + ℎ = 𝑓 𝑎 + ℎ𝑓 𝑎 + 𝑓 𝑎 + 𝑓 𝑎 + ⋯
2! 3!

d. ℎ' ' ℎ* *
𝑓 𝑎+ℎ =1+ℎ 𝑓 𝑎 + 𝑓 𝑎 + 𝑓 𝑎 +⋯
2! 3!

2. Which of the following is a numerical differentiation formula to compute 𝑓 - 𝑥 :


a. 𝑓 𝑥+ℎ −𝑓 𝑥 b. 𝑓 𝑥+ℎ +𝑓 𝑥
ℎ ℎ

c. 𝑓 𝑥 + ℎ − 2𝑓 𝑥 + 𝑓 𝑥 − ℎ d. 𝑓 𝑥+ℎ −𝑓 𝑥
ℎ' ℎ'

1
MATLAB Programming for Numerical Computations Jan–March 2018

3. Which of the following is an iterative method for solving linear equations?


a. Thomas algorithm b. Runge-Kutta
c. Gauss Elimination d. Gauss Siedel

4. Newton-Raphson method is used for:


a. Computing eigenvalues of a matrix b. Numerical differentiation
c. Nonlinear regression d. Solving nonlinear equations

5. Euler’s explicit method can be used to solve the ODE, 𝑦 - = 𝑓 𝑡, 𝑦 . Given the values
of 𝑡3 , 𝑦3 and the step-size h, the value of 𝑦 at time 𝑡345 is given by:
a. 𝑦345 = ℎ𝑓 𝑡3 , 𝑦3 b. 𝑦345 = ℎ𝑓 𝑡345 , 𝑦345
c. 𝑦345 = 𝑦3 + ℎ𝑓 𝑡3 , 𝑦3 d. 𝑦345 = 𝑦3 + ℎ𝑓 𝑡345 , 𝑦345

6. Euler’s implicit method can be used to solve the ODE, 𝑦 - = 𝑓 𝑡, 𝑦 . Given the values
of 𝑡3 , 𝑦3 and the step-size h, the value of 𝑦 at time 𝑡345 is given by:
a. 𝑦345 = ℎ𝑓 𝑡3 , 𝑦3 b. 𝑦345 = ℎ𝑓 𝑡345 , 𝑦345
c. 𝑦345 = 𝑦3 + ℎ𝑓 𝑡3 , 𝑦3 d. 𝑦345 = 𝑦3 + ℎ𝑓 𝑡345 , 𝑦345

2
MATLAB Programming for Numerical Computations Jan–March 2018

PART-2: SOME SIMPLE MATLAB STUFF (From first two lectures of this course)

In this section, I have given some simple MATLAB commands to get started.
These are not pre-requisites. We will cover this in Module-1. This is to get some
participants start early, and those who have used MATLAB before to refresh their memory.
If your college or organization has MATLAB license, you may use it for this course. For
others, courtesy of MathWorks, we will provide access to MATLAB Online for the duration
of this course. The access information will be provided in mid-January on the course website.

7. Assign the value “4” to a variable “p”

8. Use the exp command to compute exponential of p.

9. Use the log command to compute ln 𝑝 .

10. Create a vector x = [1 2 3 4 5 6] using the command: x=1:6;.

11. Create the following 3×4 matrix A:


−4 2 3 4
𝐴= 3 1 4 7
4 0 5 8
Recall that elements in a row are separated by comma or spaces, whereas multiple
rows are separated by semi-colon.

12. Type help eye to get info about eye command used to make an identity matrix

13. Create a 4×4 identity matrix using command eye and assign it to Bi.

14. Get transpose of matrix A ( transpose command is A' ). Assign it to Atrans.

15. Find eigenvalues of A using command eig.

16. Assign third element of row-2 of A to scalar c. Now c should contain value 4.

17. Obtain the second row of A and assign it to vector d.

18. Try to compute d*d. You should expect to get an error. Why?

19. Execute the following commands on vector d.


sum(d) cumsum(d) prod(d) cumprod(d) diff(d)?
Do you understand the meaning of these commands.

Potrebbero piacerti anche