home *** CD-ROM | disk | FTP | other *** search
- function [zepo,k] = zpss(th,nnu,nny,thresh)
- %ZPSS An auxiliary function to ZP
- %
- % [zepo,k] = zpss(th,nnu,nny)
- %
-
- % L. Ljung 10-2-90,11-11-91
- % Copyright (c) 1990 by the MathWorks, Inc.
- % All Rights Reserved.
-
- if ~exist('ss2zp'),error('This routine requires the SIGNAL PROCESSING TOOLBOX'),end
- [a,b,c,d,km]=eta2ss(th); [nx,nu]=size(b);[ny,nx]=size(c);
- if any(nnu>nu),error('There are not that many inputs in the model!'),end
- if any(nnu<-ny),error('There are not that many noise sources in the model!'),end
- if any(nny>ny) | any(nny<1)
- error('There are not that many outputs in the model!'),end
- T=gett(th);
- if isempty(nnu),nnu=1:nu;end
- if isempty(nny),nny=1:ny;end
- lny=length(nny);
- if any(nnu==0),
- nnu=[-ny:-1,nnu(find(nnu>0))];
- end
- if length(nnu)>0
- zepo=[];k=[];
- for ku=nnu
- G1=zeros(1+nx,2*lny)+inf;ka1=zeros(2,lny);
- if ku<0, btemp=km;dtemp=eye(ny);ku1=abs(ku);ku=500+ku1;
- else btemp=b;dtemp=d;ku1=ku;end
- [z1,p1]=ss2zp(a,btemp,c(nny,:),dtemp(nny,:),ku1);
- [nzr,nzc]=size(z1);
- if nzc<lny, %This fix is due to a bug in ss2zp
- z1=inf*ones(nx,lny);kcount=1;
- for kky=nny
- z1t=ss2zp(a,btemp,c(kky,:),dtemp(kky,:),ku1);
- if ~isempty(z1t),z1(1:length(z1t),kcount)=z1t;end,kcount=kcount+1;
- end
- end
- [k1,ph1]=trfsaux(a,btemp,c(nny,:),dtemp(nny,:),ku1,eps,T);
- k1=k1.*(1-2*abs(round(rem(ph1/180,2))));
- [rz1,cz1]=size(z1);
- for kinf=1:cz1
- kind=find(abs(z1(:,kinf))>thresh);
- if ~isempty(kind),z1(kind,kinf)=inf*ones(length(kind),1);end
- end
- G1(1,1:2:2*lny)=1000*(nny-1)+ku;
- G1(1,2:2:2*lny)=1000*(nny-1)+20+ku;ka1(1,1:lny)=1000*(nny-1)+ku;
- [nzr,nzc]=size(z1);
- G1(2:nzr+1,1:2:2*lny)=z1;
- G1(2:length(p1)+1,2:2:2*lny)=p1*ones(1,lny);
- ka1(2,1:lny)=k1;
- k=[k ka1];
- zepo=[zepo G1];
- end,end
- zepo(1,:)=sign(T)*zepo(1,:);
-
-