Solve the following system by using MATLAB a) Solve the following system by usin
ID: 3168362 • Letter: S
Question
Solve the following system by using MATLAB
a) Solve the following system by using MATLAB with Back Substitution method.
4X1 – X2 +2X3+2X4 –X5 = 4
-2X2+6X3+2X4+7X5= 0
X3 –X4-2X5 = 3
-2X4 –X5 =10
3X5=6
b) If A= [3 2 ; 1 -1] and B= [-1 ; 1] then find
I. Determent of A
II. Inverse
III. x=B
IIII. Trace
V. Rank
VI. Row reduced echelon
c). Make a program with for loop by using Cramer’s rule A= [2 1 1; 1 -1 -1; 1 2 1 ] and B= [3; 0 ; 0]
NOTE : breifly explain the Following , thank You so much !
Explanation / Answer
problem (A)
matlab code:
clc;
clear;
x5=2
x4=(10+x5)/-2
x3=3+2*x5+x4
x2=((7*x5)+(2*x4)+(6*x3))/2
x1=(4+x5-(2*x4)-(2*x3)+x2)/4
problem (B) matlab code:
clc;
clear;
A=[3 2;1 -1];
B=[-1;1]
('Determent of A')
det(A)
('Inverse of A')
inv(A)
('solution of AX=B')
X=inv(A)*B
('trace of A')
trace(A)
('Row reduced echelon')
rref(A)
('rank of A')
rank(A)
cramer rule matlab code with for loop:
clc;
clear;
A=[2 1 1;1 -1 -1;1 2 1]
B=[3;0;0;]
D=zeros(1,3)
C=det(A);
E=A;
F=A;
G=A;
('cramer rule')
for i=1:3
G(:,i)=B(:,1)
D(i)=det(G);
G=A;
end
D
('solution is')
x=D(1)/C
y=D(2)/C
z=D(3)/C
cramer rule with out for loop:
clc;
clear;
A=[2 1 1;1 -1 -1;1 2 1]
B=[3;0;0;]
D=zeros(1,3)
C=det(A);
E=A;
F=A;
G=A;
('cramer rule')
for i=1:3
G(:,1)=B(:,1)
E(:,2)=B(:,1)
F(:,3)=B(:,1)
D(1)=det(A)
D(2)=det(E)
D(3)=det(F)
('solution is')
x=D(1)/C
y=D(2)/C
z=D(3)/C
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.