home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 10.ddi / CONTROL.DI$ / SSDELETE.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  1.3 KB  |  45 lines

  1. function [ar,br,cr,dr] = ssdelete(a,b,c,d,e,f,g)
  2. % SSDELETE Remove inputs, outputs and states from state-space system.
  3. %
  4. %    [Ar,Br,Cr,Dr] = SSDELETE(A,B,C,D,INPUTS,OUTPUTS) returns the 
  5. %    state-space system with the specified inputs and outputs removed
  6. %    from the system.  The vectors INPUTS and OUTPUTS contain indexes
  7. %    into the system inputs and outputs, respectively.
  8. %
  9. %    [Ar,Br,Cr,Dr] = SSDELETE(A,B,C,D,INPUTS,OUTPUTS,STATES) returns
  10. %    a state-space system with the specified inputs, outputs, and 
  11. %    states removed from the system.
  12. %
  13. %    See also: SSSELECT.
  14.  
  15. %    Clay M. Thompson 6-27-90
  16. %    Copyright (c) 1986-93 by the MathWorks, Inc.
  17.  
  18. error(nargchk(6,7,nargin));
  19. error(abcdchk(a,b,c,d));
  20.  
  21. if (nargin==6)
  22.   inputs=e; outputs=f; states=[];
  23. end
  24. if (nargin==7)
  25.   inputs=e; outputs=f; states=g;
  26. end
  27.  
  28. % --- Remove the specified inputs,outputs and states ---
  29. ar=a; br=b; cr=c; dr=d;
  30. [nx,na] = size(a);
  31. [ny,nu] = size(d);
  32. if length(states)~=nx,
  33.   if ~isempty(a), ar(:,states)=[]; ar(states,:)=[]; else ar=[]; end
  34.   if ~isempty(b), br(states,:)=[]; br(:,inputs)=[]; else br=[]; end
  35.   if ~isempty(c), cr(:,states)=[]; cr(outputs,:)=[]; else cr=[]; end
  36. else
  37.   ar=[]; br=[]; cr=[];
  38. end
  39. if (length(inputs)~=nu)&(~isempty(d)),
  40.   dr(:,inputs)=[]; dr(outputs,:)=[];
  41. else
  42.   dr=[];
  43. end
  44.  
  45.