MATLAB: How to find the right matrix

matrixmatrix optimization

I have the following question how do I solve the following problem: I made a measurment and I got results which I have labeled with letter A I have numbers from A1,A2,A3…. A216 than I multiply it with a matrix (3×3) so I got results which I labeled with letter B so I got results B1,B2,B3…B216.
Further more I have results from device I have measured and I have labeled with letter C. So I have results from C1,C2,C3…C216
What is my goal? To find the right matrix so that would be result B1 close to C1, B2 close to C2…., B216 to C216.
Thank you very much in advance. Kind regards

Best Answer

This solution uses John's ipdm() tool (Download).
Bstack=cat(3, B1,B2,...B216); %you type the complete list of B's
Cstack=cat(3, C1,C2,...,C216); %you type the complete list of C's
B=reshape(Bstack,3,[]).';
C=reshape(Cstack,3,[]).';
S=ipdm(B,C,'subset','nearest','result','struct');
Csorted=Cstack(:,:,S.columnindex);
now Csorted(:,:,i) will be the best match to Bstack(:,:,i).
Related Question