% Script to test backSubstitution.m for
% Solving an upper triangular system by back-substitution
% Input matrix U is an n by n upper triangular matrix
% Input vector b is n by 1
% Input scalar n specifies the dimensions of the arrays
% Output vector x is the solution to the linear system
% U x = b
% K. Ming Leung, 01/26/03

clear all;
U=[ 1  2  2
    0 -4 -6
    0  0 -1];
b=[3; -6; 1];
n=length(b); 
x=backSubstitution(U,b,n);
display(x); 
        
