How to solve a simple Matrix equation?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I have a small problem. I want to solve the multiplication of a given matrix.
For Example:
A = [-1,0,0,1;1,-1,0,0;0,1,-1,0;0,0,1,-1];
x = sym('x', [4,1]);
x(1,1)=1;
solve(A*x==[0;0;0;0])
Because I am a beginner at Matlab, I really don't know what im doing wrong. In this Example x should be equal to ones.
The goal is, to use it for a big matrix and calculate all unknown 'x'. If it is not possible to calculate them, I have to estimate the missing x, and solve it with something like a Netwon-Raphson method. But that will propably be in a later question.
Thank you for answering.
0 comentarios
Respuesta aceptada
Jon
el 19 de Feb. de 2020
Editada: Jon
el 19 de Feb. de 2020
It looks like you want to find all of the vectors satisfying Ax = 0 for some singular matrix , A. If so, you can do this using
X = null(A)
This returns a basis for the null space of a matrix A.
In your case MATLAB returns X = [0.5;0.5;0.5;0.5], any multiple of this will satisfy your equation,
so for example 2*[0.5;0.5;0.5,0.5] = [1;1;1;1] is a solution and you can verify that A*[1;1;1;1]=0
To find out more about the null function type doc null on the command line in MATLAB
7 comentarios
Jon
el 20 de Feb. de 2020
Editada: Jon
el 20 de Feb. de 2020
Good catch!
Glad it seem like this approach will help you. One benefit of the least squares minimization, is that it very naturally handles the situation where you have sensor measurements of the flows but they may be noisy/slightly in error. Imagine that you in fact have all of the flows measured with noisy measurements. The measured flows will not satisfy Ax = 0 but you can find a set of flows which are as close as possible to the measured values (in the least square sense) but that satisfy Ax = 0. This is in some sense best physically consistent estimate of the overall network flows.
Más respuestas (0)
Ver también
Categorías
Más información sobre Linear Least Squares 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!