フィルターのクリア

Function with many outputs

2 ビュー (過去 30 日間)
B.E.
B.E. 2023 年 1 月 26 日
コメント済み: B.E. 2023 年 1 月 26 日
I have this function [Y_1,Y_2,Y_3,Y_4]=MyFun(X);
I want to optimize X according to this cost function using ga function of Matlab
J=@(X) Y_1.^2+Y_2.^2;
X=ga(J,numel(X));
How to write the cost function J knowing that Y_1 and Y_2 depend on X.

採用された回答

Torsten
Torsten 2023 年 1 月 26 日
X=ga(@cost,numel(X));
function J = cost(X);
[Y_1,Y_2] = MyFun(X);
J = Y_1.^2+Y_2.^2;
end
  1 件のコメント
B.E.
B.E. 2023 年 1 月 26 日
Thank you

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProblem-Based Optimization Setup についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by