Permalink
Browse files

Refactoting iter method. WIP

  • Loading branch information...
Paulche committed Mar 6, 2013
1 parent 85c9148 commit c5124af3bfa977229578372ae8c2d904c4f7bf07
Showing with 11 additions and 8 deletions.
  1. +7 −4 lab5/action.m
  2. +1 −3 lab5/iter.m
  3. +3 −1 lab5/iter_method.m
  4. BIN lab6/лр 6.doc
View
@@ -57,16 +57,19 @@ function action()
legend(H, arrayfun(@(x)(sprintf('x%d',x)),1:7,'UniformOutput',false));
ylabel('Seidel method','fontsize',20,'fontweight','b');
- A, b, exact
+ A, b
% Errors
- iter_error, norm(iter_error,1), seidel_error, norm(seidel_error)
+ iter_error, norm(iter_error), seidel_error, norm(seidel_error)
% Output iter values
- iter_solution, iter_residual, iter_norm_residual
+ iter_residual, iter_norm_residual
% Output seidel values
- seidel_solution, seidel_residual, seidel_norm_residual
+ seidel_residual, seidel_norm_residual
rel_error
+
+ % Results
+ seidel_solution, iter_solution, exact
end
View
@@ -1,8 +1,7 @@
-function r = iter(A,b,x)
+function [B c] = iter(A,b)
%
% x = B*x + c
%
-
len = length(A);
B = zeros(len);
@@ -13,5 +12,4 @@
B(i,i) = 0;
end
- r = B * x + c;
end
View
@@ -3,8 +3,10 @@
serial = [];
serial(1,:) = x;
+ [B c] = iter(A,b);
+
for i = 1:n
- r = iter(A,b,r);
+ r = B * x + c;
serial(i+1,:) = r;
end
View
Binary file not shown.

0 comments on commit c5124af

Please sign in to comment.