guassian elimination with partial pivoting
Mostrar comentarios más antiguos
hi, i'm trying to solve for a system of linear equation in form of matrices and i have made a function to perform the backward subtitute after doing all the pivoting and solve for the case where it has infinite solution only. this is what i got so far:
function x = backsub_syms(U,b)
n = length(b);
syms x [1 n]
u = rank(U);
p = n - u;
if (p == 1)
syms t
x(1,n)= t;
else if (p>1)
????????????????
end
end
for i=n-1:-1:1
m =1/U(i,i).*(b(i)-sum(U(i,i+1:end).*x(1,i+1:end)));
x(1,i)= m;
end
x=x(1,:)';
end
it is working perfectly fine only when the 1 free variable (p = 1) so in case p is larger than 1, i dont know how to approach this since this can only use symbolic variable to calculate. can some one give me an idea or a hint to complete the '??????' part
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Calculus en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!