Exercise 4 Let b vi us A D R where by matlab v v V3 V4 Vr V6

Exercise 4. Let b (vi, us), A D+ R where (by matlab v, v, V3 V4 Vr V6 25 0 01 0 v3 v5 0 v6 0 an 0 30 v1 v4 0 0 0 35 Let ao be a vector in R3. The iterative relation ack+1 D-1(b Rake), k 1,2,... can be used to obtain an approximation of the solution for A b. As mor iterations are carried out, the approximation will get more accurate.

Solution

D = [25 0 0;0 30 0;0 0 35];
R = [0 1 2;6 0 9;6 6 0];
x = [1;1;1];
A = D+R;
b = [6;6;1];
error = 0;
for i=1:15%for 15 iterations we are running a loop
x =D\\(b-R*x);%calculating x using iterative method
errormatrix = abs(A*x-b);
errorvalue = 0;
for j=1:3
errorvalue = errorvalue+errormatrix(j);%summing all elements in error matrix giving ek
end
if errorvalue<0.0001
break;
end
end

%displaying output
disp(\'no. of iterations\');
disp(i);
disp(\'final approximation\');
disp(x);
disp(\'final error\');
disp(error);

output:

no. of iterations
12

final approximation
0.2366
0.1647
-0.0402

final error
0

 Exercise 4. Let b (vi, us), A D+ R where (by matlab v, v, V3 V4 Vr V6 25 0 01 0 v3 v5 0 v6 0 an 0 30 v1 v4 0 0 0 35 Let ao be a vector in R3. The iterative rel

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site