开发者

Declare nonlinear constraint as anonymous function

开发者 https://www.devze.com 2023-02-16 16:44 出处:网络
How can I declare a nonlinear constraint in MATLAB as a开发者_如何学运维n anonymous function.I don\'t have any inequality constrained, only one equality.What you need to do is to create an anonymous f

How can I declare a nonlinear constraint in MATLAB as a开发者_如何学运维n anonymous function. I don't have any inequality constrained, only one equality.


What you need to do is to create an anonymous functions that outputs two arguments. You can do that as follows:

@(x) deal(x^2, 0 )

is what you want. The inequality constraint is the first argument. If you want to have both then equality and inequality constraints it is just.

@(x) deal(x^2, x+1)
0

精彩评论

暂无评论...
验证码 换一张
取 消