Question: 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

How do I change my code to solve for X (nxm) where

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); end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!