필터 지우기
필터 지우기

Using cell array of function handles as nonlinear constraints in fmincon

조회 수: 1 (최근 30일)
Lennart Vogt
Lennart Vogt 2018년 11월 14일
댓글: Torsten 2018년 11월 14일
I have a cell array of function handles called Eqn, the unknown variable is called T. I want to use these function handles as my nonlinear equality constraints using fmincon.
I am calling my nonlinear constraint function like this:
nonlcon = @(T)EnergyBalance(T,Eqn);
The function is defined as:
function [c,ceq] = EnergyBalance(T,Eqn)
c = [];
ceq = Eqn;
end
When running I am getting the error "FMINCON requires all values returned by functions to be of data type double." which makes sense as ceq is a cell array. However I cannot convert ceq into a double as it contains multiple function handles.
So my question is: Is there a way to use a group of function handles stored in a cell array as the nonlinear constraints for fmincon?
  댓글 수: 11
Lennart Vogt
Lennart Vogt 2018년 11월 14일
Ok then T is not handed correctly atm. T is supposed to be the unknown vector I am searching for
Torsten
Torsten 2018년 11월 14일
T is unknown, but a vector of doubles during the solution process, and your function handles have to be evaluated with this vector of doubles. T is not a vector of symbolic variables. I think you mix up symbolic with numerical computations.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

태그

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by