Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4. (20 marks) The purpose of this problem is to compare different methods of linear system solving using MATLAB. (a) Create a MATLAB script LU
4. (20 marks) The purpose of this problem is to compare different methods of linear system solving using MATLAB. (a) Create a MATLAB script LU solve.m that uses LU factorization of A to solve a linear system A = b for given A and b. You are allowed to use MATLAB built-in LU factorization function and backslash operator to solve triangular systems. (b) Write a MATLAB script to use MATLAB backslash operator directly and your own LU_solve.m to solve random linear systems of sizes n = 10,...,100. Generate Random matrices and vectors using MATLAB built-in function rand with values between 0 and 1. Then time how long it takes to solve each linear system using tic and toc functions in MATLAB (just the time for solving system and not generating random systems). Plot the results (how long it takes) as a function of the size of system, n. Plot the timing for both methods in the same plot and label them. (c) Create a MATLAB script jacobi solve.m which uses the Jacobi method to solve a linear system Az = b iteratively for given A, b and starting vector To. Use jacobi solve.m to solve the system 5.21 2x2 + 3.x3 = -1 - 3x1 + 9x2 + x3 = 2 2x1 22 7x3 = 3 using the initial guess o = {0 0 0T. Continue iterations until two successive approximations are identical when rounded to three significant digits
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started