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

  1. function [iu,nargs,y,y2]=dmulresp(fun,a,b,c,d,Ts,t,nargo,bodeflag);
  2. %DMULRESP Discrete multivariable response.
  3. %
  4. %    [IU,NARGS,Y,Y2] = DMULRESP('fun',A,B,C,D,Ts,T,NARGO,BODEFLAG)
  5.  
  6. %    Andy Grace  7-9-90
  7. %    Copyright (c) 1986-93 by the MathWorks, Inc.
  8.  
  9. [r,m]=size(d);
  10. if r*m>1     % MIMO system
  11.    iu=0;
  12.    if nargo==0
  13.     clg
  14.     hold off
  15.     if r*m==2, sp=210; else sp=220; end
  16.     if r*m>4|bodeflag==1, disp('Strike any key after each screen'), end
  17.     scnt=0;
  18.     for i=1:m
  19.         if bodeflag==0,
  20.           for j=1:r
  21.             if scnt==4, pause, clg, 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,Ts,i,t)']);
  26.             title(['Input ',int2str(i),' Output ',int2str(j)])
  27.           end
  28.         else 
  29.           if scnt==4, pause, clg, scnt=0; end
  30.           scnt = scnt+4;
  31.           eval([fun,'(a,b,c,d,Ts,i,t)']);
  32.           title(['Input ', int2str(i)])
  33.         end
  34.     end
  35.     subplot(111)
  36.   else
  37.     y=[]; y2=[];
  38.     for i=1:m
  39. % Force compile to recognize these variables:
  40.         phase =[];  mag = [];
  41.         if bodeflag==0
  42.             eval(['y=[y,',fun,'(a,b,c,d,Ts,i,t)];'])
  43.         else
  44.             eval(['[mag,phase]=',fun,'(a,b,c,d,Ts,i,t);'])
  45.             y=[y,mag]; y2=[y2,phase];
  46.         end
  47.  
  48.     end
  49.   end
  50. else        % SISO systems
  51.   iu=1; nargs=5;
  52. end
  53.  
  54.  
  55.     
  56.