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

 Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Hilfe-Center und File Exchange

Gefragt:

Sid
am 14 Nov. 2022

Beantwortet:

am 14 Nov. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by