home *** CD-ROM | disk | FTP | other *** search
- function y=idsimss(ze,eta)
- %IDSIMSS simulates a given system
- %
- % Y = idsimss(Z,ETA)
- %
- % Auxiliary function to idsim
-
- % L. Ljung 10-2-90
- % Copyright (c) 1990 by the MathWorks, Inc.
- % All Rights Reserved.
-
- [nr,nc]=size(eta);
- nd=eta(1,5);
- sspmod=getmfth(eta);
-
- [etapar,P,lambda]=th2par(eta);
- arg=getargth(eta);
- T=eta(1,2);
- if any(eta(2,8)==[2 3]),Tmod=-1;else Tmod=abs(T);end
- if length(etapar)==0,etapar=0;end
- [a,b,c,d,k,x0]=feval(sspmod,etapar,Tmod,arg);
- if max(abs(eig(a)))>1, disp('WARNING: System unstable!'),end
- [ny,n]=size(c);[n,nu]=size(b);
- [Ncap,nze]=size(ze);
- if ~any(nze==[nu nu+ny]),error('An incorrect number of inputs/noises have been specified!'),end
- if nze==ny+nu,
- sqrlam=sqrtm(lambda);
- e=ze(:,nu+1:nu+ny)*sqrlam;
- x=ltitr(a,[b k],[ze(:,1:nu) e],x0);y=(c*x' +[d,eye(ny)]*[ze(:,1:nu) e]')';
- end
- if nze==nu
- x=ltitr(a,b,ze,x0);y=(c*x'+d*ze')';
- end
-