Question: I need a write a general Matlab code about; function [U,c]=GE_m[A,b] n=length (b) for k=1:n-1 use while ( %locate row that contains 1st nonzero %

I need a write a general Matlab code about;

function [U,c]=GE_m[A,b]

n=length (b)

for k=1:n-1

use "while" ( %locate row that contains 1st nonzero

% among n^n possible entries)

If r=k, no need to swap ( % If r not= k, swap rth and kth row,

% then go them GE

If r>n disp ( If all possible pivot entries have zero, print out

" A is not invertible and the U and c returned are meaningless." Then quit out)

Command window:

1) >> A= [ 1 -1 2 -1

2 -2 3 -3

1 1 1 0

1 -1 4 3]

>> b= [ -8 -20 2 4]' transpose

>> [U,c]=GE_m(A,b)

>>x=ut_sys(U,c) check both funtion match

2) >> A=[1 1 1

2 2 1

1 1 2]

>> b= [4 6 6]' transpose

>> [U,c]=GE_m(A,b)

should get U= [ 1 1 1

0 0 -1

0 0 1] and c=[ 4, -2, 2]' transpose.

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!