Optimization: Function taking a variable value from out of the bounds
이전 댓글 표시
(Files attached)
x0 = abs([0.01, 1, 283.15, 8, 10]);
%options = optimset('PlotFcns',@optimplotfval);
fitnessfcn = @(x)Lobo(x(1), x(2), x(3), x(4), x(5));
nonlcon1 = @(x)nonlcon(x(1), x(2), x(3), x(4), x(5));
lb = abs([0.01, 1, 283.15, 8, 10]);
ub = abs([10, 18.3, 1473.15 ,20, 50]);
[X, fval] = fmincon(fitnessfcn, x0, [], [], [], [], lb, ub, nonlcon1);
I am getting imaginary values of intermediary equations in Lobo because d0 (diameter) is going below 0. Why is this happening? Also, the calculated value of MATLAB do not match the manually calculated value (calculator). e.g. F cannot be beyond 1 and when a calculator is applied to the same formula it comes around 0.1.
Result: F =
1.0087
1.0087
d0 =
-1.1697e+003
-1.1697e+003
h0 =
1.0303e+014 -7.4856e+013i
1.0303e+014 -7.4856e+013i
Tw =
314.2630
314.2630
Lf =
0.3670
0.3670
tf =
0.0025
0.0025
dbc =
0.0067
0.0067
cbt =
1.5030
1.5030
dtc =
1.5097
1.5097
ntubes =
1.5097
1.5097
Ar =
5.6371e+003
5.6371e+003
qr =
2.3992e+017 -1.7431e+017i
2.3992e+017 -1.7431e+017i
댓글 수: 8
Torsten
2018년 3월 15일
I think you mean
F = (C - x + 2.*sinh(2./x))/(2.*pi);
instead of
F = (C - x + 2.*sinh(2./x))/2.*pi;
Best wishes
Torsten.
Devdatt Thengdi
2018년 3월 15일
Devdatt Thengdi
2018년 3월 15일
Torsten
2018년 3월 15일
Since you don't provide a mathematical problem formulation, there will be nobody in the forum who can answer questions with regards to content.
For your question above: Use the MATLAB debugger. Or print out db and nb before dbc is calculated.
Best wishes
Torsten.
Devdatt Thengdi
2018년 3월 15일
Torsten
2018년 3월 15일
And the output you list for the variables is right after you start fmincon ? Or after some iterations when h0 already became complex-valued ? If the latter is the case, this should explain why the calculation leaves senseful limits.
Devdatt Thengdi
2018년 3월 15일
편집: Devdatt Thengdi
2018년 3월 15일
Torsten
2018년 3월 15일
This might be the reason.
I suggest you make a pattern search:
Take a certain number of values for the variables d0, L, Tg, nb and uo between their respective lower and upper limits. Then calculate qr and qout for all combinations of these values and inspect whether you get feasible points for your problem.
Best wishes
Torsten.
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Choose a Solver에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!