필터 지우기
필터 지우기

Issue using fmincon, using code not written by my group and updating it to work now

조회 수: 1 (최근 30일)
I am currently working with a research group on modeling aerospikes and we found an old research paper from 2003 with included MatLAB code. We are going to try to modify it but first we are trying to simplify it and just get it to run but now we're running into this error: Failure in initial objective function evaluation. FMINCON cannot continue. Our code looks like this:
pinf = .160; % Ambient pressure
at = 4; % Thruster area per unit depth
p0 = 850; % Chamber stagnation pressure
gamma = 1.4; % Specific heat ratio
numsteps = 100; % Number of steps in mach number distribution
% Start the timer so the runtime can be determined
tic;
% Initial guess for thruster angle and truncation
x0 = [50,.4];
% Lower Boundary on optimization
lb = [20,.1];
% Upper Boundary on optimization
ub = [70,1];
% Set optimization options available within FMINCON
options = optimoptions('fmincon','ScaleProblem',false);
% Call FMINCON to perform optimization to find optimum values for
% thruster angle and truncation percent for the values given
% above using the function
% AER0SP1KE_C0N for the equality and inequality constraints
[x, fval] = fmincon(@aerospike_main,x0,[],[],[],[],lb,ub,'aerospike_con', options, at, pinf, p0, gamma, numsteps);
  댓글 수: 1
Walter Roberson
Walter Roberson 2022년 12월 7일
For debugging, call
fmincon(@aerospike_main,x0)
and examine the results. See if there is an error message, or if the results are nan or inf or complex-valued.
Also I recommend changing 'aerospike_con' to @aerospike_con

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

답변 (1개)

Walter Roberson
Walter Roberson 2022년 12월 7일
For debugging, call
aerospike_main(x0, at, pinf, p0, gamma, numsteps)
and examine the results. See if there is an error message, or if the results are nan or inf or complex-valued.
Also I recommend changing 'aerospike_con' to @aerospike_con
I also recommend you read http://www.mathworks.com/help/matlab/math/parameterizing-functions.html about how to change your call to fmincon. Your current calling syntax is now undocumented, making use of an old feature that is not promised to work anymore.

카테고리

Help CenterFile Exchange에서 Surrogate Optimization에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by