フィルターのクリア

convert a function into optimization expressions

1 回表示 (過去 30 日間)
Soumili Sen
Soumili Sen 2020 年 10 月 27 日
編集済み: Soumili Sen 2020 年 10 月 27 日
Dear ,
I am writting a code on optimization based on problem based approach; ie;
syms x,y
fun=a/b; % where a and b have a large value combination of random complex no of x and y.(it is nonlinear and non convex)
x = optimvar('x');
y = optimvar('y');
prob.Objective = fcn2optimexpr(fun,x,y); -----> showing error in this line
prob.Constraints.cons1 =norm(cr)^2<=10; ------> showing error in this line
How I can proceed from here.
Thank you.

採用された回答

Walter Roberson
Walter Roberson 2020 年 10 月 27 日
The solvers are not compatible with symbolic work.
The problem-based approach does not permit you to inject your own functions. You would need to use the solver-based approach and use functions that did any necessary symbolic work internally, ensuring that whatever they returned did not have any symbolic values.
Or you could create your fun and use matlabFunction to convert it to a function handle and use the solver based approach with it.
  1 件のコメント
Soumili Sen
Soumili Sen 2020 年 10 月 27 日
編集済み: Soumili Sen 2020 年 10 月 27 日
Ok.. thanks for suggestion.
one question more. what will be the code to inject my equation within the function. like
syms x,y
fun=a/b; % where a and b have a large value combination of random complex no of x and y.(it is nonlinear and non convex)
f=matlabFunction(fun);
how I will call 'f' within a function?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeConversion Between Symbolic and Numeric についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by