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

  1. function dexresp(fun,ssflag) 
  2. %DEXRESP Example response for discrete functions.
  3. %
  4. %    DEXRESP('fun')
  5.  
  6. %    Andrew Grace 7-9-90 
  7. %    Revised 6-21-92
  8. %    Copyright (c) 1986-93 by the MathWorks, Inc.
  9.  
  10. if nargin==1, ssflag=0; end;
  11.  
  12. order=round(abs(randn(1,1))*5+2);
  13. disp('')
  14. disp([' Here is an example of how the function ', fun, ' works:'])
  15. disp('')
  16. disp(' Consider a randomly generated stable Transfer Function Model')
  17. disp(' of the form G(z)=num(z)/den(z):')
  18. [num,den]=drmodel(order)
  19. Ts = exp(randn(1,1)-2)
  20. if ssflag, 
  21.   disp('Transform to state space with: [a,b,c,d] = tf2ss(num,den);');
  22.   [a,b,c,d] = tf2ss(num,den);
  23.   call=[fun,'(a,b,c,d,Ts);'];
  24. else
  25.   call=[fun,'(num,den,Ts);'];
  26. end
  27. disp('')
  28. disp(['Call ', fun, ' using the following command (see also, help ',fun,'):'])
  29. disp('')
  30. disp(call)
  31. disp('')
  32. eval(call)
  33.