PLEASE USE MATLAB TO ANSWER ALL QUESTIONS AND SHOW CODE USED! THANKS! 6. Conside
ID: 3282986 • Letter: P
Question
PLEASE USE MATLAB TO ANSWER ALL QUESTIONS AND SHOW CODE USED! THANKS!
6. Consider the inconsistent linear system -i+2+103-19 (a) Enter the coefficient matrix A and the vector b into MATLAB for which this system is Ax = b. Use the command MCA b to enter the augmented matrix of the system, and then do a (b) We shall find a least-squares solution instead. As in the guide, enter the augmented matrix N of c) Compute the distance from Aw to b. This is the quantity that the least-squares solution mini (d) Choose a vector v whose entries are close to those of w, but different. Verify that the distance command to verify that the system is inconsistent the normal equations ATAx-Ab. Use rref to find the least-squares solution w. mizes from Av to b is larger than the quantity from the previous part.Explanation / Answer
Matlab Code:
clc
clear all
close all
A = [ 1 3 5 ; 1 2 -1 ; 0 1 4; -1 1 10; 3 7 8 ]
B = [-2;0;-5;-19;6]
M = [A B]
Rank_M = rank (M)
X = AB
C = pinv(A)*B
B1 = A*C
Output:
A =
1 3 5
1 2 -1
0 1 4
-1 1 10
3 7 8
B =
-2
0
-5
-19
6
M =
1 3 5 -2
1 2 -1 0
0 1 4 -5
-1 1 10 -19
3 7 8 6
RankM =
4
X =
23.4708
-10.9708
1.5345
C =
23.4708
-10.9708
1.5345
B1 =
-1.7692
-0.0053
-4.8329
-19.0968
5.8926
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.