Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 1 (8 points) Implement in Matlab the following functions (2 points each). In the first three functions, you are not allowed to use the

image text in transcribed

Problem 1 (8 points) Implement in Matlab the following functions (2 points each). In the first three functions, you are not allowed to use the lu function and the backslash operator. function [L, U, P] = lu-pp (A) %[L, U,P] = lu-pp (A) computes a unit lower triangular matriu L, %an upper triangular matris U, and a permutation matris p such that %P+A = L*U. %The LU factorization is computed using partial pivoting. function [L, U, P] = lu_spp (A) %[L, U,P] = lu_spp (A) computes a unit lower triangular matris L, %an upper triangular matris U, and a permutation matris P such that %P+A = L*U. %The LU factorization is computed using scaled partial pivoting function x = lu_solve (L,U,b) %Solves LUx=b by solving Ly=b and then Ux=y. %Lis unit lower triangular, U is upper triangular function (xm, XPP, Xspp] = solve all (A,b) % Solves a linear system A*2 = b using Matlab's lu and %lu-pp and lu_spp. %Returns %2m = Alb %upp solution computed using lu-pp and lu_solve | % spp solution computed using lu_spp and lu_sovle For this problem, we will investigate the errors in the computed solutions by solve_all. As a reference solution, we use a vector of ones. That is, for a given matrix A, if r = (1,1,..., 1)", we compute b= A*r and then solve Ar = b. If t is the computed solution, the error is 1-and the residual is 16 - Afl. Problem 1 (8 points) Implement in Matlab the following functions (2 points each). In the first three functions, you are not allowed to use the lu function and the backslash operator. function [L, U, P] = lu-pp (A) %[L, U,P] = lu-pp (A) computes a unit lower triangular matriu L, %an upper triangular matris U, and a permutation matris p such that %P+A = L*U. %The LU factorization is computed using partial pivoting. function [L, U, P] = lu_spp (A) %[L, U,P] = lu_spp (A) computes a unit lower triangular matris L, %an upper triangular matris U, and a permutation matris P such that %P+A = L*U. %The LU factorization is computed using scaled partial pivoting function x = lu_solve (L,U,b) %Solves LUx=b by solving Ly=b and then Ux=y. %Lis unit lower triangular, U is upper triangular function (xm, XPP, Xspp] = solve all (A,b) % Solves a linear system A*2 = b using Matlab's lu and %lu-pp and lu_spp. %Returns %2m = Alb %upp solution computed using lu-pp and lu_solve | % spp solution computed using lu_spp and lu_sovle For this problem, we will investigate the errors in the computed solutions by solve_all. As a reference solution, we use a vector of ones. That is, for a given matrix A, if r = (1,1,..., 1)", we compute b= A*r and then solve Ar = b. If t is the computed solution, the error is 1-and the residual is 16 - Afl

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

More Books

Students also viewed these Databases questions

Question

How would you handle the difficulty level of the texts?

Answered: 1 week ago

Question

love of humour, often as a device to lighten the occasion;

Answered: 1 week ago

Question

orderliness, patience and seeing a task through;

Answered: 1 week ago

Question

well defined status and roles (class distinctions);

Answered: 1 week ago