Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Below is the code and the answer for problem 1. Please post screenshots of the code for number 2 in MATLAB. 1. Write a code
Below is the code and the answer for problem 1. Please post screenshots of the code for number 2 in MATLAB.
1. Write a code in Matlab to solve a linear system of equations of any size using the simple Gauss Elimination algorithm 2. Using your code in (2) to find x, y, and z for the system of equations: 3x 4y + 2z = 1 2x+3y-3z = -1 5x 5y + 4z = 7 3 4 5 6 7 8 9 10 11 12 13 14 15 %#1 function x = linear_ngaussel (A,b) A = n x n matrix b = column vector, n x 1 n=length (b); 5x=zeros (n,1); % Perform the forward elimination for k=1:n-1 for i=k+1:n m=A (i, k)/A (k, k); for j=k+1:n Ali,j) =A (i, j)-m*A(k, j); end b(i)=b (i)-m*b (k); end end % Perform the back substitution x (n)=b (n)/A (n,n); for i=n-1:-1:1 S=b (i); for j=i+1:n S=S-A(i, j) *x(j); end x(i)=S/A(i, i); end 16 17 18 19 20 21 22 23 24 25 26 27Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started