Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pierre-Chanteloup Edwin
Gauss-Seidel
Commits
80624d5f
Commit
80624d5f
authored
Nov 04, 2019
by
E-Girl-Mira
Browse files
added algo matlab
parent
c3867519
Changes
1
Show whitespace changes
Inline
Side-by-side
gauss_seidel.m
0 → 100644
View file @
80624d5f
A = [1 2 3 4 5 ; 5 1 2 3 4 ; 4 5 1 2 3 ; 3 4 5 1 2 ; 2 3 4 5 1]
Abis = [1 -1 -200 0 ; 0 1 100 -100 ; 0 1 101 -101 ; 0 0 0 100]
b = [1 ; 1 ; 3 ; 4 ; 2]
bbis = [1 ; 1 ; 2 ; 4]
x = [0 ; 0 ; 0 ; 0 ; 0]
xbis = [0 ; 0 ; 0 ; 0]
n = size(b);
delta = 10;
tol = 1e-10;
cont = 0;
while delta > tol
&
cont
<
200
ref =
x;
for
i =
1:n(1)
tmp =
0;
if
j
!=
i
tmp =
tmp
+
A
(
i
,
j
)
*x
(
j
);
end
x(i) =
(b(i)
-
tmp
)
/
A
(
i
,
i
)
;
end
delta =
norm(ref
-
x
);
cont =
cont
+
1;
end
fprintf
('%
f
\
n
%
f
\
n
%
f
\
n
%
f
\
n
en
%
d
boucles
',
x
,
cont
);
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment