Linear least squares overdetermined system
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello all,
I was hoping for some help solving the following;
k1*x = s1
k2*y = s2
x+y = s3
Whereby k1,k2 are scalar multipliers and x, y ,s_i are 448x448x10 matrices.
AKA I'm solving 448x448x10 sets of 3 equations.
I'm not sure the syntax or correct method to enter into matlab.
?linlsq vs solve vs other?
Thank you!
1 comentario
Respuestas (1)
Bjorn Gustavsson
el 24 de Sept. de 2019
Editada: Bjorn Gustavsson
el 25 de Sept. de 2019
If I understand your problem correct you want to solve a reasonably large number of very small linear systems?
In that case you have a problem of the type:
A = [k1,0;0,k2;1 1];
A*[x;y] = [s1;s2;s3];
where you want to solve for x and y. Since you have a large number of so small equations to solve, why not calculate the least-square estimator explicitly?
A_dagger = inv(A'*A)*A';
The general advice is not to do this, but you have one 3x2 matrix to "invert" and on the order of 2e6 equations to solve.
With an explicit inverse, A_dagger, you can write the all the solutions for x and y explicitly. If k1 and k2 are numerically known you're set, if you have access to the symbolic toolbox it too lets you solve for A_dagger. This ought to be the most efficient way to solve the problem the way I've understood it.
HTH
1 comentario
Bjorn Gustavsson
el 24 de Sept. de 2019
You can one-line this if you can manage to reshape this properly:
XY = A\[s1(:),s2(:),s3(:)]';
This will give you XY as a [2 x (448*448*10)] array, from which you'd get all x from the first row and y from the second. You'd have to reshape them to your prefered 448x448x10 after that. I'd still go with the above solution.
Ver también
Categorías
Más información sobre Matched Filter and Ambiguity Function 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!