Hi Jan
The error I get is
??? Index exceeds matrix dimensions.
Since PT_mj is a [3*4] matrix and we are trying to access PT_mj(i,j) where i =4, I get this error. I take it you're getting a different error then?
Changing
deltalambda_2(i)=PT_mj(i,j)-(1-flr_jm(i,j))*PT_jm(i,j)
to
deltalambda_2(i)=PT_jm(i,j)-(1-flr_jm(i,j))*PT_jm(i,j)
prevents the error, but since I can't get my head around the intended behaviour of the code I doubt if this is really a fix. Especially since with this "fix, " deltalambda_2 is now all zeroes, and that line could be further resolved to
deltalambda_2(i)=flr_jm(i,j)*PT_jm(i,j)
which is a kind of unlikely trivial simplification unless the algorithm is totally misspecified. Without understanding more fully the context, I can't make any progress myself. Maybe you'll have more luck.
1 Comment
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/42781-how-to-overcome-the-error-message-in-the-script-below-matrix-dimension-error-due-to-different-siz#comment_87886
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/42781-how-to-overcome-the-error-message-in-the-script-below-matrix-dimension-error-due-to-different-siz#comment_87886
Sign in to comment.