(a) Solve the system using the Matlab system solver ‘\\’. (b) Have Matlab print
ID: 3108397 • Letter: #
Question
(a) Solve the system using the Matlab system solver ‘’.
(b) Have Matlab print out cond(A). (You don’t need to comment on this, just have Matlab do it.)
(c) Have Matlab print out the rank(A). (You don’t need to comment on this, just have Matlab do it.)
(d) Use lu to print out the matrices L, U, and P that Matlab obtains from the using the function lu to factor the coefficient matrix.
(e) Did Matlab permute any of the rows of the matrix for the linear system when performing an LU factorization of the coefficient matrix? For this part either answer “yes, it permuted some rows” or “no it did not,” and justify your answer based on the permutation matrix from part (d).
For this problem turn in a Matlab diary or script with the commands and output for parts (a) though (d), and a typed answer for part (e). Include all this in your Part B submission file.
01 010 8014 80041 01110 14418 1108Explanation / Answer
clc;
clear all;
close all;
A=[1 1 0 8 -1;1 4 1 0 8;0 4 1 0 0 ; 8 1 1 4 1 ;-1 8 0 1 4 ];
B= [ 0 -1 0 1 0];
x=B/A
cond_num=cond(A)
r=rank(A)
[L, U ,P] = lu(A)
x =
0.1745 0.1130 -0.0561 -0.0570 -0.1682
cond_num =
13.6530
r =
5
L =
1.0000 0 0 0 0
-0.1250 1.0000 0 0 0
0 0.4923 1.0000 0 0
0.1250 0.1077 -0.1475 1.0000 0
0.1250 0.4769 0.8689 -0.0794 1.0000
U =
8.0000 1.0000 1.0000 4.0000 1.0000
0 8.1250 0.1250 1.5000 4.1250
0 0 0.9385 -0.7385 -2.0308
0 0 0 7.2295 -1.8689
0 0 0 0 7.5238
P =
0 0 0 1 0
0 0 0 0 1
0 0 1 0 0
1 0 0 0 0
0 1 0 0 0
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.