Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MATLAB ONLY. Follow directions accordingly. DO NOT COPY FROM OTHER ANSWERS 1. Write a function MYLU to perform LU factorization for an arbitrary n n
MATLAB ONLY.
Follow directions accordingly. DO NOT COPY FROM OTHER ANSWERS
1. Write a function MYLU to perform LU factorization for an arbitrary n n matrix (under the assumption that elimination can be performed without row exchanges). Run the function on the input
3 9 5 7 1
8 8 6 0 5
2 2 4 2 4.
1 7 0 4 6
4 2 7 5 5
Test to see if this factorization is correct.
Use this template:
1.
% MYLU - The function in this m-file computes an LU factorization % of an n x n matrix under the assumption that elimination can be % performed without row exchanges. % Input: n x n matrix A.
% Output: lower triangular matrix L and upper triangular matrix U. function [L,U] = MYLU(A)
n = ...; % Get the row or column dimension of A. L = ...; % Initialize L. U = ...; % Initialize U.
% Perform elimination. % The nested for loops fix a column first, and then go to each row. for j= ... % Span certain columns of A.
for i= ... % Span certain rows of A. L(...) = ...; % Do not forget the semicolons here U(...) = ...; % to suppress intermediate output!
end end
end
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