Ayuda parse error
Publicado por Guillermo (1 intervención) el 24/10/2016 13:41:52
Hola mi problema surge al llamar a la siguiente funcion en la ventana de comandos
y me da
parse error near line 30 of file C:\Users\admin1\Downloads\GaussSeidel.m
syntax error
no se cual es mi error alguien me podria ayudar?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function x = GaussSeidel(A,b,x0,nmax)
n = length(b);
r = b'-A*x0';
cont = 0;
while norm(r) >= 10^(-6)
x = zeros(1,n);
for i = 1:n
suma1 = 0;
suma2 = 0;
for j = 1:n
if i < j
suma1 = suma1 + A(i,j)*x(j);
if j > i
suma2 = suma2 + A(i,j)*x0(j);
if i == j
suma1 = suma1 + 0;
suma2 = suma2 + 0;
end
end
x(i) = (b(i)-suma1-suma2)/(A(i,i));
end
x0 = x;
r = b'-A*x0';
cont = cont + 1;
if cont == nmax
disp("La iteracion diverge");
end
end
end
y me da
parse error near line 30 of file C:\Users\admin1\Downloads\GaussSeidel.m
syntax error
no se cual es mi error alguien me podria ayudar?
Valora esta pregunta


0