%Laplace matrix (see Pages 115-116) C = [ 25/6 -2/3 0 0 -7/6 -1/2 0 0 0 0; -2/3 23/6 -1/2 -1/2 0 -1 0 0 0 0; 0 -1/2 25/6 -7/6 0 -2/3 -2/3 0 0 0; 0 -1/2 -7/6 23/6 0 0 0 0 0 -1; -7/6 0 0 0 23/6 -1/2 0 -1 0 0; -1/2 -1 -2/3 0 -1/2 31/6 -2/3 -2/3 -2/3 0; 0 0 -2/3 0 0 -2/3 8/3 0 -2/3 -2/3; 0 0 0 0 -1 -2/3 0 10/3 -2/3 0; 0 0 0 0 0 -2/3 -2/3 -2/3 11/3 -2/3; 0 0 0 -1 0 0 -2/3 0 -2/3 10/3; ] %Fixed pin vectors (See Page 116) dx = [ -1 0 -2/3 -2/3 -1 -1 0 -3 -4 -4]; %solve for top optimization level (l=0) %NOTE: if you did not specify "options", and directly run x = quadprog(C,dx), there will be a warning. But it will not change the results. options=optimset('Algorithm', 'interior-point-convex') x = quadprog(C,dx,[],[],[],[],[],[],[],options) %the solution from matlab is as follows. The same to the results in Page 117, X^T %x = % % 0.9485 % 0.9154 % 1.2134 % 1.3171 % 1.3167 % 1.6115 % 1.9805 % 2.1350 % 2.5884 % 2.5089 %for optimization level l=1, $A1, ux1 in page 118 A1 = [ 1/5 1/5 1/5 1/5 1/5 0 0 0 0 0; 0 0 0 0 0 1/5 1/5 1/5 1/5 1/5; ] ux1 = [ 1; 3;] %solve the problem %NOTE: if you did not specify options, but directly run x = quadprog(C,dx,[],[],A1,ux1), you will obtain the same results. But there will be a message like "Optimization terminated: relative (projected) residual of PCG iteration <= OPTIONS.TolFun." x = quadprog(C,dx,[],[],A1,ux1,[],[],[],options) %the solution from matlab, same as the solution in page 118 % x = % % 0.6954 % 0.7149 % 1.1670 % 1.2075 % 1.2151 % 2.1720 % 3.0964 % 2.8431 % 3.5628 % 3.3257 %for optimization level l=2, %A2 and ux2 in page 120, A2 = [ 0 0 1/2 1/2 0 0 0 0 0 0; 1/3 1/3 0 0 1/3 0 0 0 0 0; 0 0 0 0 0 0 1/2 0 0 1/2; 0 0 0 0 0 1/3 0 1/3 1/3 0; ] ux2 = [ 1; 1; 3; 3;] x = quadprog(C,dx,[],[],A2,ux2,[],[],[],options) %the solution from matlab, same as the solution in page 121 %x = % % 0.8275 % 0.7823 % 1.0006 % 0.9994 % 1.3901 % 2.2850 % 2.8897 % 3.0586 % 3.6564 % 3.1103