0% found this document useful (0 votes)
85 views

Week 7 Programming Assignment - Question: Expected Learning Outcomes From This Assignment

The document provides instructions for a programming assignment to solve a set of equations using the Thomas algorithm in MATLAB. It includes: 1) Arranging the equations in a tridiagonal matrix structure 2) Writing a MATLAB program to compute the solution using Thomas algorithm 3) Answering multiple choice questions about the solutions It also provides an algorithm for Thomas algorithm and asks students to time the algorithm versus direct matrix inversion for increasing matrix sizes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views

Week 7 Programming Assignment - Question: Expected Learning Outcomes From This Assignment

The document provides instructions for a programming assignment to solve a set of equations using the Thomas algorithm in MATLAB. It includes: 1) Arranging the equations in a tridiagonal matrix structure 2) Writing a MATLAB program to compute the solution using Thomas algorithm 3) Answering multiple choice questions about the solutions It also provides an algorithm for Thomas algorithm and asks students to time the algorithm versus direct matrix inversion for increasing matrix sizes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Week 7 Programming assignment - Question

Q1) For the given set of equations

2T1 ― T2 = 40
― T1 + 2T2 ― T3 = 25
― T2 + 2T3 ― T4 = 0
― T3 + 2T4 = 40

a) Arrange the equations in Tridiagonal matrix structure.


b) Write a MATLAB Program to compute the solution of the matrix using Thomas algorithm.
c) Using the results from the MATLAB program, answer the ‘Multiple choice questions’ in
the Programming assignment-week 7 portal.

Expected learning outcomes from this assignment:


1. To setup and use the MATLAB online module.
2. To write a basic .m file to solve the assignment problem. The code could follow roughly
the following algorithm although the candidate is encouraged to try and experiment
with other methods too.

Algorithm:
1.) For a given N dimension matrix enter the value of Sub-diagonal, Main-diagonal and
super-diagonal matrices value. (Note: last element of super-diagonal matrix and first
element of a sub-diagonal element should be zero.)
2.) Forward elimination
For first row
P(1)=b(1)
Q(1)=d(1)/P(1)
For subsequent row
P(i)= b(i)-((a(i)*c(i-1))/P(i-1));
Q(i)= (d(i)-(a(i)*Q(i-1)))/P(i);

3.) Backward Substutution


For last row
T(N)=Q(N);
For other row
T(i)=Q(i)-(c(i)*T(i+1))/P(i);
Q2) (NOT CONSIDERED FOR EVALUATION IN THE “MULTIPLE CHOICE
QUESTIONS” PORTAL, AN ADDITIONAL QUESTION FOR THE STUDENTS TO
THINK ABOUT) Generate a Random Tridiagonal Matrix of size 10X10, 100X100,
500X500 and 1000X1000. Use the randi command and generate values within the range
of 1 to 50. Solve the matrices using Thomas algorithm and matrix inversion method (using
inv command). Use command tic-toc in MATLAB code to find out the time take to solve
the problem using both methods. Observe the difference in time between the two methods
and as the size of the matrix increases you should be able to observe a significant difference
in the time taken to solve the matrix between the two methods. Use the below table to
document and analyse your results.

S. No Size of matrices Time taken using Time taken using Time Difference
Thomas Algorithm, t1 Matrix inversion, between both
t2 method (t1-t2)
1 10X10
2 100X100
3 500X500
4 1000X1000

Reference:
https://www.youtube.com/watch?v=nHt64KA_iDY
Week 7 Programming Assignment 3
Max. mark 5

1.) For a large set of equations, the computational cost required to solve Gauss Elimination
method is _______ Thomas algorithm. (1 Mark)

2.) For the following set of equation, solution using MATLAB Programming is (3 Marks)
2T1 ― T2 = 40
― T1 + 2T2 ― T3 = 25
― T2 + 2T3 ― T4 = 0
― T3 + 2T4 = 40

3.) To solve a large set of equations (consider the case of a 3D numerical simulation) the
computational power required is _______ for Thomas Algorithm as compared to direct
Matrix inversion method. (1 Mark)

You might also like