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2>=0, u3>=0, u4>=0, u5>=0, u6>=0, u7>=0, u8>=0, u9>=0, u10>=0, u11>=0, u12>=0, u13>=0];
options=sdpsettings('verbose',1,'solver','sedumi');
model = solvesos(FeasibilityConstraints,[ ],options,[pc0;pc1;pc2;pc3;pc4;pc5;pc6;pc7;pc8;pc9;v1;v2;v3;v4;u1;u2;u3;u4;u5;u6;u7;u8;u9;u10;u11;u12;u13]); 
 vpc0=value(pc0);  
 vpc1=value(pc1);  
 vpc2=value(pc2);  
 vpc3=value(pc3);  
 vpc4=value(pc4);  
 vpc5=value(pc5);  
 vpc6=value(pc6);  
 vpc7=value(pc7);  
 vpc8=value(pc8);  
 vpc9=value(pc9); 
cof_list = [vpc0,vpc1,vpc2,vpc3,vpc4,vpc5,vpc6,vpc7,vpc8,vpc9];
ref_list=(cof_list>10^-6).*cof_list;
L=ref_list(1)*1+ref_list(2)*(x)+ref_list(3)*(y)+ref_list(4)*(z)+ref_list(5)*(x)*(x)+ref_list(6)*(x)*(y)+ref_list(7)*(x)*(z)+ref_list(8)*(y)*(y)+ref_list(9)*(y)*(z)+ref_list(10)*(z)*(z)