function Z=clean(X,tol) %CLEAN Remove terms with small coefficients % % Z = clean(X,tol) removes all variables with a coefficient smaller than tol % % % Author Johan Löfberg % $Id: clean.m,v 1.1 2006/08/10 18:00:19 joloef Exp $ if nargin==1 temp = any(X.basis,1); temp = temp(2:end); index = find(temp); else X.basis(abs(X.basis)tol,1)); end if ~isempty(index) Z = X; if length(index)~=length(Z.lmi_variables) Z.basis = Z.basis(:,[1 1+index]); Z.lmi_variables = Z.lmi_variables(index); end if ~isreal(Z.basis) & nargin==2 basis_real = real(Z.basis); basis_imag = imag(Z.basis); basis_real(abs(basis_real)