Mark critical point on the surface - Matlab

0

I'm doing this script to mark the critical point on the surface, but it is giving error: "Error in test2 (line 26) plot (xs (1), xs (2), 'r *')", someone can help me?

clc
clear
H=[2 -2;-2 4];
f=[-4;0];
A=[2 1;1 -4];
b=[6; 0];
lb=zeros(2,1);
ub=[];
[xs,fval,flag] = quadprog(H,f,A,b,[], [], lb, ub, [])

fprintf('%s ', 'Convergente: ')
if flag >0
fprintf('%s \n', 'OK')
disp('Solução obtida:')
xs;
else
fprintf('%s \', 'Não convergente!')
end

x = [0:0.01:5];
y = [0:0.01:5];
[X,Y] = meshgrid(x,y);
Z = -4.*X + X.^2 - 2.*X.*Y + 2.*Y.^2;      %função objetivo
meshc(X,Y,Z)
hold on
plot(xs(1),xs(2),'r*')
hold on
    
asked by anonymous 01.06.2018 / 20:41

0 answers