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

  1. function idplot(z,int,T,ny,PC)
  2. %IDPLOT    Plots input - output data
  3. %
  4. %    idplot(Z)   or   idplot(Z,INT)
  5. %
  6. %    Z is the input - output data [y u]. This is plotted with output over
  7. %    input. The data points specified in the row vector INT are selected.
  8. %    The default value is all data.
  9. %    If the sampling interval is T, correct time axes are obtained by
  10. %
  11. %    idplot(Z,INT,T)
  12. %
  13. %    If the data is multi-output, appropriate plots are obtained by
  14. %
  15. %    idplot(Z,INT,T,NY)
  16. %
  17. %    where NY is the number of outputs, i.e the ny first columns of Z.
  18. %
  19. %    It is assumed that the input is piecewise constant between sampling
  20. %    instants, and it is plotted accordingly. If linear interpolation
  21. %    between input data points is preferred, use
  22. %    
  23. %    idplot(Z,INT,T,NY,'LI')
  24.  
  25. %    L. Ljung 87-7-8, 92-1-25
  26. %    Copyright (c) 1987-92 by The MathWorks, Inc.
  27. %    All Rights Reserved
  28.  
  29. if nargin<5, PC='PC';end
  30. if nargin<4, ny=1;end,if isempty(ny),ny=1;end
  31. if nargin<3, T=1;end,if isempty(T),T=1;end,if T<0,T=1;end
  32. if nargin<2, int=1:length(z(:,1));end
  33. if isempty(int),int=1:length(z(:,1));end
  34. [N,nz]=size(z);nu=nz-ny;
  35. clf reset
  36. if nz==1,plot(T*int,z(int,1)),title('OUTPUT'),return,end
  37.  
  38. for ky=1:ny
  39. for ku=1:nu
  40.    clf reset
  41.    subplot(211),plot(T*int,z(int,ky))
  42.    title(['OUTPUT #',num2str(ky)])
  43.    if PC~='PC',plot(T*int,z(int,ny+ku)),end
  44.    if PC=='PC'
  45.        ax=axis;
  46.     xa(1:2:2*length(int)-1)=T*int;
  47.     xa(2:2:2*length(int)-1)=T*int(2:length(int));
  48.     ya(1:2:2*length(int)-1)=z(int,ny+ku);
  49.     ya(2:2:2*length(int)-1)=z(int(1:length(int)-1),ny+ku);
  50.     y1=min(ya);y1=y1-0.1*abs(y1);
  51.     y2=max(ya);y2=y2+0.1*abs(y2);
  52.     subplot(212),plot(xa,ya)
  53.     axis([ax(1:2) y1 y2]);
  54.     end
  55.     title(['INPUT #',num2str(ku)])
  56.     if ky+ku<nz,pause,end
  57. end
  58. end
  59.  
  60. set(gcf,'NextPlot','replace');
  61.  
  62.