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

  1. function [ae,be,ce,de] = ssselect(a,b,c,d,e,f,g)
  2. %SSSELECT Extract subsystem from larger system.
  3. %    [Ae,Be,Ce,De] = SSSELECT(A,B,C,D,INPUTS,OUTPUTS) returns the
  4. %    state space subsystem with the specified inputs and outputs.  The
  5. %    vectors INPUTS and OUTPUTS contain indexes into the system
  6. %    inputs and outputs respectively.
  7. %
  8. %    [Ae,Be,Ce,De] =  SSSELECT(A,B,C,D,INPUTS,OUTPUTS,STATES) returns
  9. %    the state space subsystem with the specified inputs, outputs,
  10. %    and states.
  11. %
  12. %    See also: SSDELETE.
  13.  
  14. %    Clay M. Thompson 6-26-90
  15. %    Copyright (c) 1986-93 by the MathWorks, Inc.
  16.  
  17. error(nargchk(6,7,nargin));
  18. error(abcdchk(a,b,c,d));
  19.  
  20. [nx,na] = size(a);
  21.  
  22. if (nargin==6)
  23.   inputs=e; outputs=f; states=1:nx;
  24. end
  25. if (nargin==7)
  26.   inputs=e; outputs=f; states=g;
  27. end
  28.  
  29. % --- Extract system ---
  30. if ~isempty(a), ae = a(states,states);  else ae=[]; end
  31. if ~isempty(b), be = b(states,inputs);  else be=[]; end
  32. if ~isempty(c), ce = c(outputs,states); else ce=[]; end
  33. if ~isempty(d), de = d(outputs,inputs); else de=[]; end
  34.