Optimization of 2 matrices
이전 댓글 표시
Hi Guys,
I need to solve a problem. I have an idea to do that, just am confused about which functions to use to implement the idea.
So I have 2 matrices. Each matrix contains n rows and 2 columns. The matrix is essentially the x and y co-ordinates of n points. Matrix 1 consists of the co-ordinates at time 't' and Matrix 2 at time 't+Δt'.
The idea.
1.I want to find all possible combinations of the elements in matrix 1 with matrix 2. Since I have 'n' rows, I will have 'n!' combinations.
2. After finding the combinations, I want to calculate the distance between the two points. I use the default formula i.e sqrt((x1-x2)^2+(y1-y2)^2).
3. So i ll have n! n*1 distance matrices. I want to add all the elements in one matrix and then find the matrix that has the least total value amongst all n! matrices.
4. Now the matrix that has the least total distance, I want to take the second matrix (that led to that combination) in my forward calculation.
I am stuck in steps 1, 2 and the final correspondence in step 4. Could anyone tell me what functions I could use to serve my purpose.
Thanks. NS.
I hope I explained the problem clearly.
To simplify things,
if [a b c] and [d e f] are my initial matrices with a-f being the coordinates of points. The matrices are column matrices and should actually contain 2 columns. I have just simplified it. The possible combinations will be [ad be cf], [ad bf ce], [ae bd cf], [ae bf cd], [af bd ce], [af be cd]. After steps 3 and 4, I find that [ae bd cf] gives me the least distance. I want to take the matrix [e d f] in my forward calculations.
댓글 수: 4
bym
2011년 5월 23일
I don't think your simplification adds anything, in fact it confuses me. You state the matrix 1 & 2 are nx2, yet your example is 1x3??
NS
2011년 5월 24일
John D'Errico
2011년 5월 24일
Um, wrong. Since you have two matrices with n rows in each, all possible combinations will be n^2, NOT n!, i.e., not factorial(n).
NS
2011년 5월 24일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Surrogate Optimization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!