The below given constrained function is used in the objective function that is going to be minimized by using fmincon.
fun=@(x) 2*(1-x)*(0.5<=x)*(x<=1)
The objective function is
obj =(c(i).*x(i)+b(i).*quad(fun,l,u))
Due to the function defined in the corresponding interval I get the error:
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> @(x)2*(1-x)*(0.5<=x)*(x<=1)
Caused by:
Failure in initial user-supplied objective
function evaluation. FMINCON cannot continue
fun=@(x) 2*(1-x)*(0.5<=x)*(x<=1)
The objective function is
obj =(c(i).*x(i)+b(i).*quad(fun,l,u))
Due to the function defined in the corresponding interval I get the error:
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> @(x)2*(1-x)*(0.5<=x)*(x<=1)
Caused by:
Failure in initial user-supplied objective
function evaluation. FMINCON cannot continue