How to Loop variables
1 次查看(过去 30 天)
显示 更早的评论
Look the example of this:
The objective of the example is x(1) + x(2). It is easy to type manually.
But I have 1155 variable [meaning x(1)+x(2)+...+x(1155)] to optimise and it will take ages to type manually. Thus I must use loop.
My main part is to solve optivar('x',1,1155,'LowerBound',0,'UpperBound',0) - 1155 variables.
How to use the loop in here?
2 个评论
Walter Roberson
2019-11-19
x = optivar('x',1,1155,'LowerBound',0,'UpperBound',1234); %upper bound same as lower bound is unlikely
sumx = sum(x);
回答(0 个)
另请参阅
类别
在 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!