+clc; clear; close all;
+
+x0 = [2.1 0 2.1]';
+OPTIONS = optimset('Algorithm','active-set','TolX',1e-10,'TolCon',1e-10,'TolFun',1e-10);
+x = fmincon('foppg1',x0,[],[],[],[],[],[],'constraints',OPTIONS)
+
+% Plotting av figur (Klønete)
+x1 = 0:0.1:5;
+x2 = 0:0.1:5;
+[a,b,c] = sphere(50);
+a = 2*a; b =2*b; c = 2*c;
+a(a<0) = nan; b(b<0) = nan; c(c<0) = nan;
+for i=1:length(x1)
+ ok = 1;
+ for j=1:length(x2)
+ if sqrt(x1(i).^2 + x2(j).^2) <= 5
+ c1(i,j) = sqrt(x1(i).^2 + x2(j).^2);
+ else
+ c1(i,j) = 5;
+ end
+
+ if (4 - x1(i).^2 - x2(j).^2) >= 0
+ c2(i,j) = sqrt(4 - x1(i).^2 - x2(j).^2);
+ else
+ if ok == 1
+ c2(i,j) = 0;
+ ok = 0;
+ else
+ c2(i,j) = NaN;
+ end
+ end
+ c3(i,j) = 5;
+ f8(i,j) = 8 - x1(j).^3 + 6*x1(j).^2 - 11*x1(j);
+ f2(i,j) = 2 - x1(j).^3 + 6*x1(j).^2 - 11*x1(j);
+ end
+end
+hold on
+axis([0 5 0 5 0 5])
+surf(x2,x1,c1,'FaceColor',[1 0.5 0],'FaceAlpha',1);
+surf(a,b,c,'FaceColor','yellow')
+surf(x2,x1,c3,'FaceColor','red','FaceAlpha',1);
+mesh(x2(4:36),x1,f8(:,4:36),'EdgeColor','black','FaceColor','blue','FaceAlpha',0.5);
+mesh(x2(1:3),x1,f2(:,1:3),'EdgeColor','black','FaceColor','green','FaceAlpha',0.5);
+xlabel('x_1'); ylabel('x_2'); zlabel('x_3')
+scatter3([2,0,0,sqrt(2)],[0,sqrt(2),0,0],[2,sqrt(2),2,sqrt(2)],75,'white','filled','Marker','o','MarkerEdgeColor','black')
+legend('c_1 = 0','c_2 = 0','c_3 = 0','f = 8','f = 2','x_i')
+% Slutt plotting