在绘制不等式时,我遇到了MATLAB的问题。 这些ineq。涉及象征性替代。但是当X或Y为零时,除以零,所以我需要避免计算这些点。
tr=trace(A);
de=det(A);
[X,Y]=meshgrid(-1:0.1:1,-1:0.1:1); % Make a grid of points between 0 and 1
for i=1:length(X)
for j=1:length(X)
ineq(i,j)=0;
if X(i,j) ~= 0 && Y(i,j)~= 0
ineq(i,j)=double(subs(tr, {a, b},{[X(i,j)], [Y(i,j)]}))<0 & double(subs(de, {a, b},{[X(i,j)], [Y(i,j)]}))>0;
else
ineq(i,j)=0;
end
j=j+1;
end
i=i+1;
end
scatter(X(:),Y(:),3,ineq(:),'filled')