Matlab error message, help please

  • Thread starter Thread starter Daniel1992
  • Start date Start date
  • Tags Tags
    Error Matlab
Click For Summary

Discussion Overview

The discussion revolves around a Matlab error message encountered while working on a script related to differential equations. Participants explore the nature of the error and seek advice on troubleshooting the issue.

Discussion Character

  • Technical explanation, Homework-related

Main Points Raised

  • One participant reports an error message indicating that subscript indices must be real positive integers or logicals, specifically occurring on line 14 of their code.
  • Another participant suggests that the issue likely stems from earlier code, as the error indicates improper indexing.
  • A later reply reveals that the original poster identified the error as a missing multiplication operator in their code.
  • Participants acknowledge the common oversight of missing elements in code.

Areas of Agreement / Disagreement

Participants generally agree that the error is related to indexing issues, but the specific cause was initially unclear until it was identified by the original poster.

Contextual Notes

The discussion does not include the complete source code, which limits the ability to diagnose the problem comprehensively.

Who May Find This Useful

Individuals working with Matlab, particularly those dealing with coding errors in mathematical or engineering contexts.

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.
 

Similar threads

  • · Replies 13 ·
Replies
13
Views
3K
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
15
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K