MATLAB: How to define handle for fmincon

fminconhandles

I am doing a minimization for a function using fmincon.
please see attached function code and solver script.
The objective function is defined as f in line 200.
The constraints matrix also ready [Aeq] in line 203.
The equality vector [beq] is in line 207.
The main function script is working very well.
The problem is that I cannot run the solver. (The solver refers to function code terms as "Undefined function or variable"). As if the solver can't find the function although the function and the solver are in the same path.
When I tried to fix that I got error "FMINCON only accepts inputs of data type double.".
Musab

Best Answer

The main function script is working very well.
Nope. Your cwt.m function is not returning any actual numbers.
>> out=cwt(x0); class(out)
ans =
'sym'
You need to provide actual numeric values for the variables ('delta_a', 'delta_c', 'delta_t', 'Di'). You cannot define them with sym().
Also, Aeq and beq should not be generated inside cwt(). Your cwt_solver() function cannot see them there.