Hi there,
I want to modfy the type of function_handle in Simulink Matlab function. Here is the codes
fun = @(x)100*(x(2)-x(1)^2)^2 + (1-x(1))^2;
x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon)
function [c,ceq] = circlecon(x)
c = (x(1)-1/3)^2 + (x(2)-1/3)^2 - (1/3)^2;
But the error reports
It is not possible to write a value of type function_handle to a variable of type double. Code generation does not support changing the type by assignment. To investigate the cause of the type mismatch, check the previous assignment or input type setting.
How to create an empty function_handle?
I don't want to repeat the call fmincon like
x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,@circlecon)
x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,[])
best regards,
Tianyuan