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

  1. function [zepo,k]=zpsssd(th,ku,ky,thresh)
  2. %ZPSSSD An auxiliary function to TH2ZP
  3. %
  4. %    [zepo,k]=zpsssd(th,ku,ky)
  5. %
  6.  
  7. %    L. Ljung 10-2-90
  8. %    Copyright (c) 1990 by the MathWorks, Inc.
  9. %    All Rights Reserved.
  10.  
  11. nu=th(1,3);ny=th(1,4);T=th(1,2);
  12. if any(ku>nu),error('There are not that many inputs in the model!'),end
  13. if any(ku<-ny),error('There are not that many noise sources in the model!'),end
  14. if any(ky>ny) | any(ky<1),
  15.    error('There are not that many outputs in the model!'),end
  16. if isempty(thresh),thresh=100000;end
  17. if isempty(ku),if nu>0,ku=1:nu;else ku=0;end,end
  18. if isempty(ky),ky=1:ny;end
  19. ku1=ku(find(ku>0));if any(ku==0),ku=[-ny:-1,ku1 ];end
  20. zepo=[];k=[];
  21. for ko=ky
  22.     if any(ku==-ko),kku=[ku1,0];flag=1;else kku=ku1;flag=0;end
  23.     if ~isempty(kku)
  24.     th1=thss2th(th,ko);
  25.     [zep,kt]=th2zp(th1,kku);
  26.     if flag,
  27.       zep(1,find(abs(zep(1,:)>500)))=abs(zep(1,find(abs(zep(1,:)>500))))+...
  28.       (ko-1);
  29.       kt(1,find(kt(1,:)>500))=kt(1,find(kt(1,:)>500))+ko-1;
  30.     end
  31.     zep(1,:)=(ko-1)*1000+abs(zep(1,:));
  32.     kt(1,:)=(ko-1)*1000+kt(1,:);
  33.     else zep=[];kt=[];end
  34.     zepo=zpform(zepo,zep);
  35.     k=[k kt];
  36. end
  37. if ~isempty(zepo),zepo(1,:)=sign(T)*zepo(1,:);end