Solving linear systems in Matlab
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
L'O.G.
el 24 de Ag. de 2023
Editada: Bruno Luong
el 24 de Ag. de 2023
How do I solve for x in u = A(x+b)? A is a matrix, and the other terms are vectors. Isn't it something like x = A\u - b ? I'm not sure about subtracting the b term, however.
1 comentario
Bruno Luong
el 24 de Ag. de 2023
Editada: Bruno Luong
el 24 de Ag. de 2023
In some sense x = A\u - b is the worse you can pick.
Respuesta aceptada
Torsten
el 24 de Ag. de 2023
Editada: Torsten
el 24 de Ag. de 2023
x = A\(u-A*b)
But it's the same as
x = A\u - b
1 comentario
Bruno Luong
el 24 de Ag. de 2023
Editada: Bruno Luong
el 24 de Ag. de 2023
Is it?
A=rand(3,4);
b=rand(4,1);
u=rand(3,1);
% 4 different solutions
x1=A\(u-A*b)
x2=A\u-b
x3=lsqminnorm(A,u)-b
x4=lsqminnorm(A,u-A*b)
% All give the same "fitness"
A*x1-u
A*x2-u
A*x3-u
A*x4-u
norm(x1)
norm(x2)
norm(x3)
norm(x4) % always the smallest
Más respuestas (1)
Steven Lord
el 24 de Ag. de 2023
Define a new variable y such that y = x+b.
Using this new variable simplifies your system to u = A*y.
Solve this simplified system for y using the backslash operator, y = A\u.
Substituing into that solution using the definition of y, we know x+b = A\u.
Subtract b from both sides to get x = (A\u)-b.
0 comentarios
Ver también
Categorías
Más información sobre Mathematics and Optimization 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!