Matlab error message, help please

  • Thread starter Thread starter Daniel1992
  • Start date Start date
  • Tags Tags
    Error Matlab
AI Thread Summary
The error message "Subscript indices must either be real positive integers or logicals" indicates an issue with indexing in the Matlab code. The problem arises on line 14, but the actual fault likely occurs earlier in the code. A user identified that a missing multiplication operator (*) was the cause of the error. This highlights the importance of careful code review to catch simple mistakes. Attention to detail is crucial in debugging Matlab scripts.
Daniel1992
Messages
21
Reaction score
0
I get this error message

Subscript indices must either be real positive integers or logicals.

Error in doubleODE (line 14)
dYdt(2) = l1*(m1 + m2)*Y(4) - l2*m2*Y(3)*cos(Y(1) - Y(2))/...

I am having trouble working out what is causing the problem. Any advice?

Thanks
 
Physics news on Phys.org
It means that you have indices which are not positive integers or logicals so that it chokes on line 14
The actual fault will be before then - without the source code we cannot possibly help.
 
I found the error. Turns out I missed a * when multiplying :-|
 
Well done.
Amazing what you miss.
 
Back
Top