自己写的纯真形法的matlab代码,输入终究纯真形

2020-04-08 admin 原创
浏览

  %纯真形法

  function D=dcx2(A)

  M=length(A(:,1));

  n=length(A(1,:));

  if max(A(M,M+1:n))<=0

  D=A;

  else

  [x,y]=max(A(M,M+1:n));

  y=y+M;

  B=A(2:M-1,y);

  theta=A(2:M-1,2)http://blog.sina.com.cn/s/B;

  b=find(theta==min(theta(find(theta>0))));

  A(:,b+2)=A(:,y)+A(:,b+2);

  A(:,y)=A(:,b+2)-A(:,y);

  A(:,b+2)=A(:,b+2)-A(:,y);

  A(b+1,1)=y-2;

  A1=A(2:M-1,3:M);

  A1(:,b)=0;

  for

  i=1:M-2

  if length(find(A1(i,:)==0))==length(A1(i,:))

  i=i+1;

  A(i,2:n)=A(i,2:n)http://blog.sina.com.cn/s/A(i,b+2);

  break;

  end

  end

  for j=2:M-1

  if i~=j

  A(j,2:n)=A(j,2:n)-A(i,2:n)*A(j,b+2);

  end

  end

  for i=M+1:n

  A(M,i)=A(1,i)-A(2:M-1,i)'*A(1,3:M)';

  end

  D=dcx2(A);%假设要显示每步纯真形表,去掉落该句最后的分号便可!

  end

  end