Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

function submission1

%NOTE: Please comment your input variables.


%I only want to see the answers returned by your functions.

% As you could see, all my input variables are suppresed.

%% Question 1a

A1 = [2 1 -1 2;4 5 -3 6;-2 5 -2 6;4 11 -4 8];b1=[5; 9; 4;2];% for question (a)%


x = GaussianElimination(A1,b1)

%% Question 1b

A2 = [3 1 -1;1 -4 2;-2 -1 5];b2 = [3;-1;2];% for question (b)


[x,U]=GaussianEliminationmodified(A2,b2)

%% Question 1c

A = [1 -1 2 -1;2 -2 3 -3;1 1 1 0;1 -1 4 3]; % for question (c)


B = [-8 -10 -100;-20 -20 -250;-2 -2 -25;4 8 80];
[x,U,C] = Gaussianmultiplesystem(A,B)

%% Question 2a

A = [1 -1 2 -1;2 -2 3 -3;1 1 1 0;1 -1 4 3];

disp(' Partial pivoting is to be used')


[P, L ,U] = LU(A)

%% Question 2b

A = [1 -1 2 -1;2 -2 3 -3;1 1 1 0;1 -1 4 3];


B = [-8 -10 -100;-20 -20 -250;-2 -2 -25;4 8 80];
x = LUsolve(A,B)

%% Question 3

disp(' put answer to question 3 here')


disp('the disp function seems to work per line.')
disp('you may need to use more disp function in order to')
disp('present all your answers for this question')

You might also like