Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactoting iter method. WIP

  • Loading branch information...
commit c5124af3bfa977229578372ae8c2d904c4f7bf07 1 parent 85c9148
@Paulche authored
View
11 lab5/action.m
@@ -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
4 lab5/iter.m
@@ -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
4 lab5/iter_method.m
@@ -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
BIN  lab6/лр 6.doc
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.