I need to use Minimize in a For loop and I can't find the solution from the previous posts.
Here is my case:
I have a reference matrix Mx and 2 other matricies My1 and My2. I want to find alfa's such that the error between Mx and alfa*My is minimized. QuadError() computes the quadratic error between Mx and alfa*My. Error() isolates the parameter alfa. I then want to run a loop alfa_and_error that finds alfa for the two matrices My.