Minimizing a objective function, which includes an integral with argument 'x' and some unknown variables.

Objective function:
f1=
f2=
R1, R2 are the unknown variables whose values are to be optimized so that the objective function get maximized (-minimized).
Ws,Ss1,Ss2 are constants.
How to declare R1 and R2?
Declared x as syms, R1 and R2 if declared as optimvar then error is must be floating scalers, if declared as syms then converting the expression to numeric is showing error (vpa, double) as explicit exp is not possible to convert.
Thanks for answering in advance

 Réponse acceptée

R0 = [1 5];
R = fminsearch(@fun,R0)
function y = fun(R)
R1 = R(1);
R2 = R(2);
% Declare parameters
...
f1 = @(x) ...
f2 = @(x)...
int1 = integral(f1,0,R1);
int2 = integral(f2,R1,R1+R2);
y = -(int1+int2)
end

Plus de réponses (0)

Catégories

En savoir plus sur Symbolic Math Toolbox dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by