Discrete variable in optimization

10 ビュー (過去 30 日間)
kartik pandya
kartik pandya 2015 年 8 月 24 日
コメント済み: kartik pandya 2015 年 8 月 24 日
Dear sirs, I have a variable x whose min. and max value are 0.900 and 1.00. I have randomly generated its value between its min and max limits. suppose the ans=0.984. I want that the ans should be discrete in the step of 0.025 ie. only five ans. are feasible. They are 0.900, 0.925, 0.950, 0.975 and 1.000. so i want to know matlab command/program/equation using which i can convert the ans(=0.984) into nearest discrete value(i.e.0.975). Thanks in advance

採用された回答

Walter Roberson
Walter Roberson 2015 年 8 月 24 日
floor((x - 0.900)/0.025) * 0.025 + 0.900
  1 件のコメント
kartik pandya
kartik pandya 2015 年 8 月 24 日
dear sir Thanks for your reply and nullifying my doubt.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGlobal or Multiple Starting Point Search についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by