warning while running optimization tool
1 次查看(过去 30 天)
显示 更早的评论
Index in position 1 exceeds array bounds (must not exceed 40)
What does this mean?photo is attached below
please help
0 个评论
采纳的回答
Walter Roberson
2020-1-25
We can predict that your objfun has a place where you use Variable(Parameter) where you should have Variable.*(Parameter)
That is, you try to use implicit multiplication, but MATLAB does not have implicit multiplication, and the operation you are accidentally invoking is indexing instead of multiplication.
In MATLAB A(B) is always either indexing variable A at offset B, or else calling the function indicated by A passing in parameter B. A(B) in MATLAB never means to multiply A and B.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!