15NTL37 SIMULATION AND MODELLING LAB syllabus for NT


Module-2 0 hours

2. Solve using MATLAB the following array operations:
(a) 1+ [2 3 –1].
(b) 3 x [1 4 8] .
(c) [1 2 3] x [0 –1 1].
(d) Square each element of the vector [2 3 1].

Module-4 0 hours

4. Consider the following linear system:
2x1 + 2 x2=18
-x1 + 2 x2=2
solve the system using the graphical method with MATLAB

Module-6 0 hours

6. Write a well-commented function program for the function x2 e−x2 , usingentry-wise operations (such as .* and .^). To get ex use exp(x). Includeadequate comments in the program. Plot the function on [−5, 5]. Turn inprintouts of the program and the graph.

Module-7 0 hours

7. Write a well-commented script program that graphs the functions sin x, sin 2x,sin 3x, sin 4x, sin 5x and sin 6x on the interval [0, 2π] on one plot. (π is pi inMatlab.) Include comments in the program. Turn in the program and thegraph.

Module-8 0 hours

Suppose a ball is dropped from a height of 2 meters onto a hard surface andthe coefficient of restitution of the collision is .9 (see Wikipedia for anexplanation). Write a well-commented script program to calculate the totaldistance the ball has traveled when it hits the surface for the n-th time. Enter:format long. By trial and error approximate how large n must be so that totaldistance stops changing. Turn in the program and a brief summary of theresults.

Module-9 0 hours

9. (a) Write a well-commented Matlab function program myinvcheck that
a. makes a n × n random matrix (normally distributed, A = randn(n,n)), •
b. calculates its inverse (B = inv(A)), •
c. multiplies the two back together, •
d. calculates the residual (difference from the desired n × n identitymatrix eye(n)), and •
e. returns the norm of the residual.


(b) Write a well-commented Matlab script program that calls myinvcheckfor n= 10, 20, 40, . . . , 2 i10 for some moderate i, records the results of each trial,and plots the error versus n using a log plot. (See help loglog.)What happens to error as n gets big? Turn in a printout of the programs, theplot, and a very brief report on the results of your experiments.

Module-10 0 hours

10. You are given the following data:
> t = [ 0 .1 .499 .5 .6 1.0 1.4 1.5 1.899 1.9 2.0]
> y = [ 0 .06 .17 .19 .21 .26 .29 .29 .30 .31 .31]
(a) Plot the data, using ”*” at the data points, then try a polynomial fit of thecorrect degree to interpolate this number of data points: What do youobserve. Give an explanation of this error, in particular why is the term badlyconditioned used?
(b) Plot the data along with a spline interpolant. How does this compare withthe plot above? What is a way to make the plot better?

Last Updated: Tuesday, January 24, 2023