How can I convert a function with multivariable input to a function with single vector input?
9 ビュー (過去 30 日間)
Hi, I want to use fmincon, and fmincon can deal with only function with single vector input.
When my formula is as below, it works well.
fun = @(x) x(1)^2+x(2)^2;
However, if the function form has multiple input as below, it does not work.
Is there any way to convert the fun2 below to the function with single vector input as the example above?
fun2 = @(x,y) x^2+y^2;
fmincon(fun2,[1,1]) % this does not work