Looping With Transition Matrices
1 回表示 (過去 30 日間)
古いコメントを表示
Any help with this would be great. I have 2 Matrices, say A and B, which when multiplied make C. I then need to compare the elements of A and C like for like, choosing the largest to make Matrix D. D will then go through the same initial iterations as A until the value of D is unchanged when choosing the largest values.
I have used D=max(A,C) to find D, but I am finding it difficult to loop the process. I have also tried using tf=isequal(A,D), then while tf=0 to run the loop but to no avail.
Any help will be much appreciated.
1 件のコメント
AJ von Alt
2014 年 1 月 28 日
Can we see what you have done so far? What part of constructing the loop are you having problems with?
回答 (1 件)
Amit
2014 年 1 月 28 日
I don't know the process you're doing on D to make it equal to A. However with floating points, there can be carry over like 1.0 and 1.0000001. Here even though 1.0000001 might be an artifact of the process and calculations, but is not equal to 1.0.
You can try
tol = 1e-6;
while (norm(A-D) < tol)
2 件のコメント
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!