Write a MATLAB function that solves tridiagonal systems of equations of size n. Assume that no pivoting
Question:
Write a MATLAB function that solves tridiagonal systems of equations of size n. Assume that no pivoting is needed, but do not assume that the tridiagonal matrix A is symmetric. Your program should expect as input four vectors of size n (or n — I): one right-hand-side b and the three nonzero diagonals of A. It should calculate and return x = A— lb using a Gaussian elimination variant that requires 0(n) flops and consumes no additional space as a function of n (i.e., in total 5n storage locations are required).
Try your program on the matrix defined by n = 10, a i-1 , i = a i+1 , i = —i, and ai, i = 3i for all i such that the relevant indices fall in the range 1 to n. Invent a right-hand-side vector b.
An Introduction to the Mathematics of Financial Derivatives
ISBN: 978-0123846822
3rd edition
Authors: Ali Hirsa, Salih N. Neftci