How to solve for the minimum of a complex function
Ältere Kommentare anzeigen
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);
Akzeptierte Antwort
Weitere Antworten (1)
Walter Roberson
am 31 Mär. 2018
Bearbeitet: Walter Roberson
am 31 Mär. 2018
0 Stimmen
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.
Kategorien
Mehr zu Symbolic Math Toolbox finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!