フィルターのクリア

I am using genetic algorithm optimization toolbox. i have done evrything i am also getting output and all. but i want is i want the output in particular range.

1 回表示 (過去 30 日間)
For example
function t=compST(input)
x(1) = input(1);
x(2) = input(2)
x(3) = input(3)
x(4) = input(4)
x(5) = input(5)
t = 122.14-0.84.*x(1)-0.42.*x(2)+0.34.*x(3)-0.09.*x(4)+363.77.*x(5);
output = [t]
here t is compressive strenth . i want the t in range of 40-80 MPA range how can i do that

採用された回答

Walter Roberson
Walter Roberson 2022 年 3 月 9 日
編集済み: Walter Roberson 2022 年 3 月 10 日
If you are using ga() then the above link shows you how to halt if the function value is within a specified value.
  4 件のコメント
Walter Roberson
Walter Roberson 2022 年 3 月 10 日
options = optimoptions('ga', 'FitnessLimit', 400, 'MaxGenerations', 1e5);
A = []; b = []; Aeq = []; beq = []; lb = []; ub = []; nonlcon = [];
obj = @(x) (compST(x)-60).^2;
bestx = ga(obj, 5, A, b, Aeq, beq, lb, ub, nonlcon, options);
Optimization terminated: minimum fitness limit reached.
display(bestx)
bestx = 1×5
-7.4205 -9.9567 3.9257 7.0063 -0.2431
display(compST(bestx))
44.8276
function t=compST(x)
t = 122.14-0.84.*x(1)-0.42.*x(2)+0.34.*x(3)-0.09.*x(4)+363.77.*x(5);
end
harsh Brar
harsh Brar 2022 年 3 月 11 日
編集済み: harsh Brar 2022 年 3 月 14 日
i wanna thank you wholeheartedly. i am absolute beginner in matlab. i have been spinning my mind around this for a while now. thank you.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGenetic Algorithm についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by