Use of backslash while calculating the product of inverse of a matrix and another matrix
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Yaswanth Sai
el 5 de Dic. de 2019
Comentada: Yaswanth Sai
el 6 de Dic. de 2019
I am trying to implement successive overrelaxation method. I am getting different answers when I distributed the inverse between two matrices
First way:
xt = (D+omg*L)\((D*(1-omg)-omg*U)*xn+omg*B);
Second way:
xt = (D+omg*L)\((D*(1-omg)-omg*U)*xn)+omg*(D+omg*L)\B);
where D, L, and U are matrices of same size, xn is a vector and omg is a scalar value. But when I use "inv" function instead of backslash, I am getting the same answer in both the cases i.e,
xt = inv(D+omg*L)*((D*(1-omg)-omg*U)*xn+omg*B);
xt = inv(D+omg*L)*((D*(1-omg)-omg*U)*xn)+omg*inv(D+omg*L)*B);
0 comentarios
Respuesta aceptada
Andrei Bobrov
el 6 de Dic. de 2019
Editada: Andrei Bobrov
el 6 de Dic. de 2019
Maybe for "second way":
xt = (D+omg*L)\((D*(1-omg)-omg*U)*xn+omg*((D+omg*L)\B));
Más respuestas (0)
Ver también
Categorías
Más información sobre Resizing and Reshaping Matrices 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!