Can i know the step and have the code? Question 4: Gaussian Elimination and...
50.1K
Verified Solution
Question
Accounting
Can i know the step and have the code?
Question 4: Gaussian Elimination and LU Factorization with MATLAB (40 marks) You will use MATLAB to carry out elementary row operations (Gaussian Elimination) and to obtain the matrix factorization P=LU for a square 3 x 3 matrix P. (a) Initialize the random number generator by using Random Seed where abcd are the last four digits of your student ID number. Make sure your included this line in your write-up. Generate a random 3 x 3 matrix P and calculate the three principal minors of P. The LU factorization P=LU is only possible when all the principal minors are non-zero. Since P is a random matrix, this situation is certainly satisfied. If any of the number after the matrix P is zero, repeat this step again until you can generate a matrix P with all three numbers after P is non-zero. Make sure you include all the matrices that you generate this way in your assignment report. When the matrix P for all three principal minors are non-zero, transform the matrix P into an upper-triangular matric U using only one type of row operation: adding a multiple of one row to a row below. You will choose multipliers to put zeros below the diagonal elements. At the end of the LU algorithm Uwill be upper triangular. Start by entering the initial value U = P in MATLAB. using m-file called coli.m. The m-file requires a 3 x 3 matrix U to be already defined in your workspace. Execute this file by typing coli at the MATLAB prompt. The matrix L1 should be unit lower triangular with non-zero entries only on the diagonal and in column 1. Set up U = L1 * U using MATLAB. Remember that the command X = Y in MATLAB means to replace the current value of the variable X by the current value of the variable Y. The new matrix U should have zeros in the first column below the main diagonal. (b) Next, for the LU factorization put a zero below the main diagonal in column 2 of U. Use the MATLAB editor to create a m-file called col2.m This procedure required the matrix U modified from (a). Execute this file by typing col2 at the MATLAB prompt. The matrix L2 should be unit lower triangular with non-zero entries on the diagonal and in column 2. Now set U=L2 * U using MATLAB. The new matrix U should have all zeros below the main diagonal. Using MATLAB to verify that U = L2 * L1 * P (c) To complete the P=LU factorization, calculate inv(L1), inv(L2), L = inv(L1)*inv(L2) Question 4: Gaussian Elimination and LU Factorization with MATLAB (40 marks) You will use MATLAB to carry out elementary row operations (Gaussian Elimination) and to obtain the matrix factorization P=LU for a square 3 x 3 matrix P. (a) Initialize the random number generator by using Random Seed where abcd are the last four digits of your student ID number. Make sure your included this line in your write-up. Generate a random 3 x 3 matrix P and calculate the three principal minors of P. The LU factorization P=LU is only possible when all the principal minors are non-zero. Since P is a random matrix, this situation is certainly satisfied. If any of the number after the matrix P is zero, repeat this step again until you can generate a matrix P with all three numbers after P is non-zero. Make sure you include all the matrices that you generate this way in your assignment report. When the matrix P for all three principal minors are non-zero, transform the matrix P into an upper-triangular matric U using only one type of row operation: adding a multiple of one row to a row below. You will choose multipliers to put zeros below the diagonal elements. At the end of the LU algorithm Uwill be upper triangular. Start by entering the initial value U = P in MATLAB. using m-file called coli.m. The m-file requires a 3 x 3 matrix U to be already defined in your workspace. Execute this file by typing coli at the MATLAB prompt. The matrix L1 should be unit lower triangular with non-zero entries only on the diagonal and in column 1. Set up U = L1 * U using MATLAB. Remember that the command X = Y in MATLAB means to replace the current value of the variable X by the current value of the variable Y. The new matrix U should have zeros in the first column below the main diagonal. (b) Next, for the LU factorization put a zero below the main diagonal in column 2 of U. Use the MATLAB editor to create a m-file called col2.m This procedure required the matrix U modified from (a). Execute this file by typing col2 at the MATLAB prompt. The matrix L2 should be unit lower triangular with non-zero entries on the diagonal and in column 2. Now set U=L2 * U using MATLAB. The new matrix U should have all zeros below the main diagonal. Using MATLAB to verify that U = L2 * L1 * P (c) To complete the P=LU factorization, calculate inv(L1), inv(L2), L = inv(L1)*inv(L2)Get Answers to Unlimited Questions
Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!
Membership Benefits:
- Unlimited Question Access with detailed Answers
- Zin AI - 3 Million Words
- 10 Dall-E 3 Images
- 20 Plot Generations
- Conversation with Dialogue Memory
- No Ads, Ever!
- Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Other questions asked by students
StudyZin's Question Purchase
1 Answer
$0.99
(Save $1 )
One time Pay
- No Ads
- Answer to 1 Question
- Get free Zin AI - 50 Thousand Words per Month
Best
Unlimited
$4.99*
(Save $5 )
Billed Monthly
- No Ads
- Answers to Unlimited Questions
- Get free Zin AI - 3 Million Words per Month
*First month only
Free
$0
- Get this answer for free!
- Sign up now to unlock the answer instantly
You can see the logs in the Dashboard.