% Help to plot functions in 3-D
%Anders Möller, 2010-10-07

%Positive semidefinite
%surface
x=[-2:0.1:2];
y=[-2:0.1:2];
[X,Y]=meshgrid(x,y);
Z=X.^2-Y;
figure
surf(X,Y,Z)
title('Positive semidefinite')
hold on
%feasible set 1
x0=zeros(length(x));
z=-y;
temp = plot3(x0,y,z);
set(temp,'LineWidth',5)
set(temp,'Color',[0 0 0])
%feasible set 2
hold on
y0=zeros(length(y));
z=x.^2;
temp = plot3(x,y0,z);
set(temp,'LineWidth',5)
set(temp,'Color',[1 0 0])
xlabel('x')
ylabel('y')