Can someone explain why I am getting the error "Not enough input arguments (line 2)"?

2 visualizaciones (últimos 30 días)
function f = fun( x )
f = 4./x(1)+9./x(2)+(x(1)+x(2));
end
function [ c,cequ ] = mycon( x )
c=[-x(1);
-x(2);
x(1)+x(2)-4];
cequ=[];
end
function myfun
x0=[1;1];
[x,f]=fmincon(@fun,x0,[],[],[],[],[],[],@mycon)
z=peaks;
surf(z);
end

Respuestas (1)

Stephan
Stephan el 24 de En. de 2021
x0=[1;1];
[x,f]=fmincon(@fun,x0,[],[],[],[],[],[],@mycon)
z=peaks;
surf(z);
function f = fun( x )
f = 4./x(1)+9./x(2)+(x(1)+x(2));
end
function [ c,cequ ] = mycon( x )
c=[-x(1);
-x(2);
x(1)+x(2)-4];
cequ=[];
end

Categorías

Más información sobre Software Development Tools en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by