软件开发与应用O.I.Automation20062510ExploitationandApplicationofSoftware2006,Vol.25,No.10·88·10061576200610008803Matlab050003MatlabMatlabTP273ASystemModelingBasedonSystemIdentificationToolboxinMatlabQIXiao-hui,TIANQing-min,DONGHai-rui(Dept.ofOptics&ElectronicsEngineering,OrdnanceEngineeringCollege,Shijiazhuang050003,China)Abstract:ThefunctioninsystemidentificationtoolboxofMatlabmainlyincludesparametricornonparametricmodelidentification,modelvalidation,regressiveparameterestimation,modelclassdefinitionandconversion,andgraphicinterface.So,basedonthetoolbox,thesystemwasestablishedmodels.Themainstepsincludedatacollection,datapreprocess,modelstructureselection,parametersestimation,modelvalidationanddynamicsimulation,etc.Keywords:Systemmodeling;Systemidentificationtoolbox;Matlab0IOMatlab11.1idinputuidinput(N,type,band,levels)Ntypetyperstyperbstypeprbstypesineband12rsrbssineband[,]Nyquist01prbsband[2logp,M](22logp1)1Mband[0,1]levels12rs111.20dtrendidfiltButterworthidresamp3zddtrend(z,o,brkp)[zf,thf]idfilt(z,ord,Wn,hs)[zr,R_act]idresamp(z,R,filter_order,tol)z[yu]oo0o1brkp2006-06-082006-06-301962软件开发与应用O.I.Automation20062510ExploitationandApplicationofSoftware2006,Vol.25,No.10·89·ordWnhsWn1Wn[WlWh]WnhshighWnhsstopWn[WlWh]zfIOthfThetazrR_actRRR1R1filter_order8tolR0.11.3ARXARMAXBJThetastrucarxstrucivstrucselstrucstrucARXNNstruc(NA,NB,NK)NANBARXA(q)B(q)NKARXNNarxstrucARXvarxstruc(ze,zv,NN)ze[yu]IOzv[yrur]IONNNNnn[nanbnk]v1ivstrucARXvivstruc(ze,zv,NN)arxstrucselstruc[nn,vmod]selstruc(v,c)varxstrucivstrucc1.4ARARXARMAXBJararxarmaxivxrarxrarmaxarARthar(y,n,approach)ynARapproachfblsywYuleWalkerburgBurgglarxivxARXtharx(z,nn)thivx(z,nn)z[yu]nn[na,nb,nk]ARXA(q-1)B(q-1)armaxARMAXtharmax(z,nn,’trace’)znn[na,nb,nc,nk]ARMAXA(q-1)B(q-1)C(q-1)’trace’rarxARARXthmrarx(z,nn,adm,adg)zzyARnnARARXARnnA(q-1)ARXarxadmadgadmffadg=lamadmugadggamadmngadggamadmkfadgR1KalmanrarmaxARMAARMAXIOthmrarmax(z,nn,adm,adg)zzyARMAnnARMAARMAXARMAnn[na,nc]ARMAX软件开发与应用O.I.Automation20062510ExploitationandApplicationofSoftware2006,Vol.25,No.10·90·nnarmaxadmadgrarx1.5compareresidpepredictidsimcompareresidpepredictidsim2ARX0510152025051015202510-1ImpulseresponsesStepresponsesARX2101ARX[1])k(v)2k(u5.0)1k(u)2k(y7.0)1k(y5.1)k(y+−+−=−+−−v(k)ARX21M%ARXclf;A=[1-0.50.7];B=[010.5];th0=poly2th(A,B);u=idinput(300,'rbs');y=idsim([u,randn(300,1)],th0);%z=[yu];ir=cra(z);th=arx(z,[221]);%imp=[1;zeros(19,1)];irth=idsim(imp,th);%subplot(211)plot(ir,'--');holdon;plot(irth,'r')legend('','ARX')title('impulseresponses')%subplot(212)plot(cumsum(ir),'--');holdonplot(cumsum(irth),'r')legend('','ARX')title('stepresponses')[2])k(v)2k(u5.0)1k(u)2k(y7.0)1k(y5.1)k(y+−+−=−+−−v(k)N(0,1)u(k)15M)k(v)2k(u2b)1k(u1b)2k(y2a)1k(y1a)k(y+−+−=−+−+2M%clearU=idinput([15160],'prbs',[01],[-11]);%i=900;R0=1;S=2.^25*eye(4);Y=zeros(i,1);theta0=[1.5;-0.7;1;0.5];%theta=[1;1;1;1];V=idinput(i,'rgs',[01],[01]);%form=3:iX=[Y(m-1)Y(m-2)U(m-1)U(m-2)];Y(m)=X*theta0+V(m);F=S'*X';Beta=R0+F'*F;Arfa=1/(Beta+(R0*Beta)^0.5);K=S*F/Beta;theta(:,(m-1))=theta(:,(m-2))+K*(Y(m)-X*theta(:,(m-2)));S=(eye(4)-Arfa*Beta*K*X)*S/R0^0.5;end%result=[(-theta(1:2,(i-1)));theta(3:4,(i-1))];%figure;plot(1:(i-1),-theta(1,:),'--',1:(i-1),-theta(2,:),'-.',1:(i-1),theta(3,:),':',1:(i-1),theta(4,:),'-');A=plot(1:(i-1),-theta(1,:),'--',1:(i-1),-theta(2,:),'-.',1:(i-1),theta(3,:),':',1:(i-1),theta(4,:),'-');legend(A,'a1','a2','b1','b2');title('');holdonMatlab020040060080010-1-2b1a2b2a12[1],.[M].:,2003.[2].Matlab[J].,2003,(4):5153.[3],,.Matlab[M].:,2000.