How to find minimum and maximum input values that a function is defined on
Ältere Kommentare anzeigen
Hello,
I am trying to run fmincon on a function that is not defined over all input values. I would like to run fmincon over the entirety of the defined portion of the function. Is there any way to have matlab output the minimum and maximum input values permitted for a given function?
For context, my function is below. I can't hard code the min and max values because when I eventually run it in a for loop, I will be changing the values of beta_2o, which will then change the range of beta_1 values that are possible.
Any help would be appreciated!
% input initial conditions
T = 1000
beta_1o = 0.7
beta_2o = 0.7
g = 0.1
%function
f1 = @(beta_1)-(((T*beta_2o)/(0.5*(1+g)*beta_2o*beta_1+2*beta_1))^0.5+beta_1*(0.5*(1+g)*(T - ((T-beta_1)/(0.5*(1+g)*beta_1*beta_2o+2*beta_2o))-(T-beta_2o)/(0.5*(1+g)*beta_1*beta_2o+2*beta_1)))^0.5);
%fmincon functions
A = [];
b = [];
eq = [];
beq = [];
nonlcon = [];
x0 = [0]
lb = %lowest possible beta_1 allowed by f1?
ub = %highest possible beta_1 allowed by f1?
[xmin,fmin] = fmincon(f1,x0,A,b,eq,beq,lb,ub,nonlcon)
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Optimization 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!