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

  1. function zepo=zpform(zp1,zp2,zp3,zp4,zp5)
  2. %ZPFORM    Formats zero-pole matrices from different models for use in ZPPLOT
  3. %
  4. %    ZEPO = zpform(ZEPO1,ZEPO2,....,KU)
  5. %
  6. %    ZEPO1, ZEPO2,... are matrices obtained from TH2ZP, which are
  7. %    merged into ZEPO.
  8. %    
  9. %    KU is an optional row vector containing the input numbers to be
  10. %    picked out when forming ZEPO. The default value of KU is all inputs
  11. %    present in ZEPO1, ZEPO2,....  A maximum of five input arguments to
  12. %    zpform is possible.
  13. %    
  14. %    Example: zpplot(zpform(ZPBJ1,ZPOE1,ZPBJ2)) compares the poles and
  15. %    zeros obtained in different models of different orders.
  16.  
  17. %    L. Ljung 7-3-87
  18. %    Copyright (c) 1987-90 by the MathWorks, Inc.
  19. %    All Rights Reserved.
  20.  
  21. noch=1;
  22. [r1,c1]=size(zp1);
  23. if nargin<2,zp2=[];end
  24. [r2,c2]=size(zp2);if r2==1,inpind=zp2; noch=0;zp2=[];r2=0;c2=0;end
  25. if nargin<3,zp3=[];end
  26. [r3,c3]=size(zp3);if r3==1,inpind=zp3; noch=0;zp3=[];r3=0;c3=0;end
  27. if nargin<4,zp4=[];end
  28. [r4,c4]=size(zp4);if r4==1,inpind=zp4; noch=0;zp4=[];r4=0;c4=0;end
  29. if nargin<5,zp5=[];end
  30. [r5,c5]=size(zp5);if r5==1,inpind=zp5; noch=0;zp5=[];r5=0;c5=0;end
  31. r=max([r1 r2 r3 r4 r5]);
  32. zepo=[[zp1;zeros(r-r1,c1)+inf],[zp2;zeros(r-r2,c2)+inf],[zp3;zeros(r-r3,c3)+inf]];
  33. zepo=[zepo,[zp4;zeros(r-r4,c4)+inf],[zp5;zeros(r-r5,c5)+inf]];
  34. if noch,return,end
  35. info=zepo(1,:);colind=[];
  36. [mi,ni]=size(info);
  37. for k=inpind
  38.  
  39. colind=[ colind,find(rem(info,20*ones(mi,ni))==k)];
  40. end
  41. zepo=zepo(:,colind);
  42.