How to solve for the minimum of a complex function
古いコメントを表示
Hello, I am trying to optimize my system by varying one parameter, r, which will change an intermediate variable, kg, and ultimately result my one unknown, Se. My goal is to find the value r, which will result in the smallest value of Se.
I tried simplifying my process by fixing "r" at a single value and solving my symbolic "eqn" for Se. However, the only real solution isn't correct. My plan was to then take this equation for "Se" and vary "r" and plot "r vs. Se" and see the minimum. But no luck.
It would be great if I could take "eqn" and find the derivate dSe/dr = 0. But the way the equation is complicated with the symbol and the natural log, I couldn't get this to work either.
% Fixed Parameters:
Z = 10;
alpha = 40;
delta = 0.5;
Xa = 40;
k = 7.57;
Q = 1000;
So = 500;
Se = 20;
H = 15.42;
% Optimization Variable, r
r = 3; % In reality this variables range will be from 0 <= r <= 5
% Intermediate Variable
Kg = 50 + (200/(1+r)^2);
% Equation with one unknown, Se
syms Se
eqn = (Kg*log((So + 2*Se)/(20*(1 + r))) + (So - Se)/(1 + r))*(Q*(1 + r))/(k*Xa*delta*alpha*Z*H);
solve(eqn, Se, 'Real', true);
採用された回答
その他の回答 (1 件)
Walter Roberson
2018 年 3 月 31 日
編集済み: Walter Roberson
2018 年 3 月 31 日
0 投票
The value of Se that minimizes eqn is Se = -250/(1+eps) (that is, the first representable number greater than -250) where it approaches -inf . (At Se = -250 itself you get NaN.)
If you take solve(diff(eqn,Se),Se), which gives a solution in R2018a, then the value you get is for maximizing the Se that solves the equation, given r.
カテゴリ
ヘルプ センター および File Exchange で Symbolic Math Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!