Why the function or variable A is not recognized?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Pierre Hansel Malihan
el 26 de Mayo de 2022
Comentada: Pierre Hansel Malihan
el 26 de Mayo de 2022
function [L, U] = lu_nopivot (A)
n = size(A, 1);
L = eye(n);
for k = 1 : n
L(k + 1 : n, k) = A(k + 1 : n, k) / A(k, k);
for l = k + 1 : n
A(l, :) = A(l, :) - L(l, k) * A(k, :);
end
end
U = A;
end

0 comentarios
Respuesta aceptada
Walter Roberson
el 26 de Mayo de 2022
You have not defined A in the base workspace, so it does not exist for you to be able to pass its value into the function.
3 comentarios
Walter Roberson
el 26 de Mayo de 2022
Example:
A = magic(11)
[Lout, Uout] = lu_nopivot(A)
A2 = randi([-9 9], 11, 11)
[Lout2, Uout2] = lu_nopivot(A2)
function [L, U] = lu_nopivot (A)
n = size(A, 1);
L = eye(n);
for k = 1 : n
L(k + 1 : n, k) = A(k + 1 : n, k) / A(k, k);
for l = k + 1 : n
A(l, :) = A(l, :) - L(l, k) * A(k, :);
end
end
U = A;
end
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!