Professional Documents
Culture Documents
Assignment 1
Assignment 1
1|Page
Table of content
Answers to the questions
Question 1 3-9
Question 2 10-11
Question 3 12
Question 4 13-16
Question 5 17
2|Page
Question 1 answer
Manual solution
3|Page
4|Page
Mathlab answers and graphs:
a)
5|Page
b)
6|Page
c)
7|Page
d)
8|Page
9|Page
Question 2 answer:
Manual solution:
10 | P a g e
Mathlab solution:
11 | P a g e
Question 3 answer:
Mathlab solution: eigenvalues and eigenvectors
12 | P a g e
Question 4 answer:
Manual solution:
13 | P a g e
14 | P a g e
Mathlab coding from command history:
Matlab code for guass elimiation method:
function x = solveGauss(A,b)
s = length(A);
for j = 1:(s-1)
for i = s:-1:j+1
m = A(i,j)/A(j,j);
A(i,:) = A(i,:) - m*A(j,:);
b(i) = b(i) - m*b(j);
end
15 | P a g e
end
x = zeros(s,1);
x(s) = b(s)/A(s,s);
for i = s-1:-1:1
sum = 0;
for j = s:-1:i+1
sum = sum + A(i,j)*x(j);
end
x(i) = (b(i)- sum)/A(i,i);
end
16 | P a g e
Question 5 answer:
17 | P a g e