Answered step by step
Verified Expert Solution
Question
1 Approved Answer
How do I change my code to solve for X (nxm) where A is nxn and B is nxm? AX=B My code only solves for
How do I change my code to solve for X (nxm) where A is nxn and B is nxm? AX=B
My code only solves for X (nx1) where A is nxn and B is nx1
unction [x] Gauss SPP (A, B B) Ex] In, n] size (A) format long l- (1:n) Pivoting vector s max (abs (A')); Computes the max of each row Scaled Partial Pivoting for k 1: (n-1 t abs (A(1(k), k)/s (k))) uk k; for i (k+1):1:n v- abs (A( (i),k) /s (l(i))) if v t uk end end li 1( uk) l (uk) 1(k) 1(k) ui for i (k+1):n A(l(i), k A(l (i), k)/A(1(k),k) for j (k+1 :n A(l (i), j) A( (i),j) (A (l (i),k)* A(1(k) j)) end end end Forward Elimination y zeros (n,1) (1) B( (1) for i 2:1:n y (i) B (i)) for j 1:(i-1) y (i) (i) (A(1(i),j)*y (j)); end end Back Substitution x zeros (n,1) x(n) y (n) /A(u (n), n) for i (n-1):-1:1 x (i) y (i) for j (i-1):1:n x(i) x (i) (A(L(i), j)*x(j)); end x (i) x (i) /A (l(i),i); endStep 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