MATHEMATICAL METHODS IN ELECTRICAL ENGINEERING QUESTION PLEASE SHOW ALL WORK!!!!
ID: 2989661 • Letter: M
Question
MATHEMATICAL METHODS IN ELECTRICAL ENGINEERING QUESTION PLEASE SHOW ALL WORK!!!!!!!!!!!!!
MATHEMATICAL METHODS IN ELECTRICAL ENGINEERING QUESTION PLEASE SHOW ALL WORK!!!!!!!!!!!!! 4. The augmented matrix below represents a linear system of equations. Solve for the variables using any tool you choose (computer, calculator, Matlab). Full point for correct answer; no points for partial credit. If it has no solution, or no unique solution, please 5 0 3 2 4 -27 2 4 0 1 1 10 9 9 -3 2 1 60 2 1 16 3 4 -79 0 6 5 8 1 37 state that.Explanation / Answer
Solving the system of equations by Gaussian Elimination
%naiv_gauss.m---------------------------------------------------------------------------------------------------------
function x = naiv_gauss(A,b)
n = length(b); x = zeros(n,1);
for k=1:n-1 % forward elimination
for i=k+1:n
xmult = A(i,k)/A(k,k);
for j=k+1:n
A(i,j) = A(i,j)-xmult*A(k,j);
end
b(i) = b(i)-xmult*b(k);
end
end
% back substitution
x(n) = b(n)/A(n,n);
for i=n-1:-1:1
sum = b(i);
for j=i+1:n
sum = sum-A(i,j)*x(j);
end
x(i) = sum/A(i,i);
end
end
---------------------------------------------------------------------------------------------------------------------------------
%gauss.m--------------------------------------------------------------------------------------------------------------------
A = [5 0 3 2 4;2 4 0 1 1;9 9 -3 2 1;2 1 16 3 4;0 6 5 8 1];
b =[-27;10;60;-79;37];
X= naiv_gauss(A,b)
------------------------------------------------------------------------------------------------------------------------------
Output:
X =
3.0000
2.0000
-4.0000
7.0000
-11.0000
--------------------------------------------------------------------------------------------------------------------------------
So the solution is X matrix.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.