×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Upper triangularization method using matlab

Upper triangularization method using matlab

Upper triangularization method using matlab

(OP)
Function X = uptrbk(A,B)
%Input – A is an N x N nonsingular matrix
% B is an N x 1 matrix
% Output – X is an N x 1 matrix containing the solution to AX=B
% Initialize X and the temporary storage matrix C

[N N] = size(A);
X=zeros(N,1);
C=zeros(1,N+1);

%Form the augmented matrix: Aug=[A|B]

Aug=[A B];
for p=1 : N-1

%partial pivoting for column p
[Y,j] = max(abs(Aug(p:N,p)));

%Interchange row p and j
C=Aug(p,: );
Aug(p,: ) = Aug (j+p-1,: );
Aug(j+p-1,: )=C;
If Aug(p,p)==0
'A was singular. No unique solution'
Break
end

% Eliminating process for column p
for k=p+1:N
m=Aug(k,p)/Aug(p,p);
Aug(k,p:N+1)=Aug(k,p:N+1)-m*Aug(p,p:N+1);
end
end

%Back substitution on [U|Y]
X=backsub(Aug(1:N,1:N),Aug(1:N,N+1));




The above program is to construct the solution to AX=B by reducing the augmented matrix [A B] to upper triangularization method and then performing back substitution.

I am trying to modify this program so that it will solve M linear systems with the same coefficient matrix A but different column matrices B . The M linear systems look like AX1 = B1 AX2 = B2 ...... AXm=Bm
(1 , 2 and m are in subscript)


Please help or any suggestions!!!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources