This is what I was able to do thanks for all the help. I will post the final solution to the larger problem if anyone wants to see it.
clc
clear
m= [2 -3 ; 3 -2];
q = [ -1 -1 ]';
xv = sym('x1');
lm = length(m);
yv = sym(zeros(1, lm))';
zv = sym(zeros(1, lm))';
for k=1:lm
yv(k) = sym(sprintf('x%d', k+1));
zv(k) = sym(sprintf('x%d', k+lm+1));
end
A = [m*yv+xv*q+zv;-(m*yv+xv*q); yv-zv;zv-yv];
for i=1:length(A)
A(i,:)=sort(A(i,:));
end
xx = cat(1,xv ,yv,zv);
Aineq = zeros(numel(A),numel(xx));
for j=1:length(A)
for i=1:length(xx)
y=xx(i);
[c,t]=coeffs(A(j),y);
if (length(t)<2)
else
insert=c(2);
Aineq(j,i)=insert;
end
end
end
Aineq;
bineq=zeros(length(Aineq),1);
for temp=1:(length(zv))
bineq(temp,1)=1;
end
Best Answer