Skip to content

Commit

Permalink
Lab{4,5} are ready
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrit committed Mar 21, 2013
1 parent 3982baa commit 2984689
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
13 changes: 13 additions & 0 deletions 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
3 changes: 3 additions & 0 deletions lab4/action.m
Expand Up @@ -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
4 changes: 2 additions & 2 deletions 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);

Expand All @@ -13,7 +13,7 @@

for i = 1:n
x = B * x + c;
serial = [serial; transp(x)];
serial = [serial; x'];
end

solution = x;
Expand Down
4 changes: 2 additions & 2 deletions 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);
Expand All @@ -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;
Expand Down

0 comments on commit 2984689

Please sign in to comment.