Skip to content
Browse files

Lab{4,5} are ready

  • Loading branch information...
1 parent 3982baa commit 2984689dc3b9b44a5d85429c015f30a2b0ae643c @Paulche committed Mar 21, 2013
Showing with 20 additions and 4 deletions.
  1. +13 −0 lab4/action.asv
  2. +3 −0 lab4/action.m
  3. +2 −2 lab5/iter_method.m
  4. +2 −2 lab5/seidel_method.m
View
13 lab4/action.asv
@@ -0,0 +1,13 @@
+function action()
+
+ % Draw plot
+ x = 0.1:0.1:4;
+ y = f;
+ H = plot(x,y(x));
+
+ dsolution = d_solve(1,2,15)
+ nsolution = n_solve(15,1.1)
+ fzero_solution = fzero(f,[1 2])
+
+ derror = abs(
+end
View
3 lab4/action.m
@@ -8,4 +8,7 @@ function action()
dsolution = d_solve(1,2,15)
nsolution = n_solve(15,1.1)
fzero_solution = fzero(f,[1 2])
+
+ derror = abs(dsolution - fzero_solution)
+ nerror = abs(nsolution - fzero_solution)
end
View
4 lab5/iter_method.m
@@ -1,6 +1,6 @@
function [solution conv serial] = iter_method(A,b,x,n)
r = x;
- serial = transp(x);
+ serial = x';
[B c] = compute_bc(A,b);
@@ -13,7 +13,7 @@
for i = 1:n
x = B * x + c;
- serial = [serial; transp(x)];
+ serial = [serial; x'];
end
solution = x;
View
4 lab5/seidel_method.m
@@ -1,5 +1,5 @@
function [solution conv serial] = seidel_method(A,b,x,n)
- serial = transp(x);
+ serial = x';
len = length(x);
[B c] = compute_bc(A, b);
@@ -19,7 +19,7 @@
for i = 1:len
x(i) = (b(i) - sum(A(i,1:i-1)*x(1:i-1)) - sum(A(i,i+1:end)*x(i+1:end))) / A(i,i);
end
- serial = [ serial; transp(x) ];
+ serial = [ serial; x' ];
end
solution = x;

0 comments on commit 2984689

Please sign in to comment.
Something went wrong with that request. Please try again.