function [J]=Objective(x)

indmat

C8=(x(im_xt(1)+13));
C9=(x(im_xS1(2)+13));
C10=(x(im_xS2(3)+13));
C11=1-sum(x(im_xr+13));

J =-sum([C8;C9;C10;C11]);%Objective, maximize sum of purity of all products
