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

  1. function [iu,nargs,y,y2]=mulresp(fun,a,b,c,d,t,nargo,bodeflag);
  2. %MULRESP Multivariable response.
  3. %
  4. %    [IU,NARGS,Y,Y2] = MULRESP('fun',A,B,C,D,T,NARGO,BODEFLAG)
  5.  
  6. %    Andrew Grace  7-9-90
  7. %    Revised ACWG 6-21-92
  8. %    Copyright (c) 1986-93 by the MathWorks, Inc.
  9.  
  10. [r,m]=size(d);
  11. if r*m>1     % MIMO system
  12.     iu=0;
  13.     if nargo==0
  14.         clg
  15.         hold off
  16.         if r*m==2, sp=210; else sp=220; end
  17.         scnt=0;
  18.         for i=1:m
  19.             if bodeflag==0,
  20.                 for j=1:r
  21.                     if scnt==4, drawnow, figure, scnt=0; end
  22.                     scnt=scnt+1; subplot(sp+scnt)
  23.                     if ~isempty(c), cj = c(j,:); end
  24.                     if ~isempty(d), dj = d(j,:); end
  25.                     eval([fun,'(a,b,cj,dj,i,t);']);
  26.                     title(['Input ', int2str(i),' Output ',int2str(j)])
  27.                 end
  28.             else 
  29.                 if scnt==4, drawnow, figure, scnt=0; end
  30.                 scnt = scnt+4;
  31.                 eval([fun,'(a,b,c,d,i,t);']);
  32.                 subplot(211)
  33.                 if (m > 1)
  34.                     title(['Input ', int2str(i)])
  35.                 end
  36.             end
  37.         end
  38.         subplot(111)
  39.     else
  40.         y=[]; y2=[];
  41.         for i=1:m
  42.             if bodeflag==0
  43.                 eval(['y=[y,',fun,'(a,b,c,d,i,t)];'])
  44.             else
  45. % Force compile to recognize these variables: 
  46.                 phase =[];  mag = [];
  47.                 eval(['[mag,phase]=',fun,'(a,b,c,d,i,t);'])
  48.                 y=[y,mag]; 
  49.                 y2=[y2,phase];
  50.             end
  51.  
  52.         end
  53.     end
  54. else        % SISO systems
  55.     iu=1; nargs=5;
  56. end
  57.  
  58.