How to obtain a contour plot from given function?
Mostrar comentarios más antiguos
function cost = obj_function(x)
cost =(x(1)).^2+(x(2)-3).^2;
end
%% the lines after comments are new files but in the same folder(the below is the constraints)
function [c, ceq] = nonlcon(x)
ceq = (x(1).^2)+(3*x(2))-3;
c = x(1).^2.*4 + x(2).^2.*9 - 36;
%%below is the rest of it
LB = [];
UB = [];
X0 = [-1, 1000000];
A = [];
B = [];
Aeq = [];
Beq = [];
[x, fval] = fmincon(@obj_function, X0, A, B, Aeq, Beq, UB, LB, @nonlcon)
My entire function is given above. It maybe confusing to understand but how can i implement my function into contour function?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Function Creation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
