n=1000; % Generovani AR(2) procesu s parametry: PHI = [0.5,0.2]; sigma2=2.25; sigma=sqrt(sigma2); [x,phir,thetar]=armagen(PHI,[],n,sigma); [par0,v,isf,errc] = NAGpest(AR(2),x); par0{:},v,isf ans = 0.5526 0.1709 ans = Empty matrix: 1-by-0 ans = Empty matrix: 1-by-0 ans = Empty matrix: 1-by-0 v = 2.3858 isf = 1 0 0 0 [par,parS,v,optOUT,errc] = NAGest(AR(2),x,par0);par{:},parS{:},v,optOUT ans = 0.5538 0.1699 ans = Empty matrix: 1-by-0 ans = Empty matrix: 1-by-0 ans = Empty matrix: 1-by-0 ans = 0.0313 0.0313 ans = Empty matrix: 1-by-0 ans = Empty matrix: 1-by-0 ans = Empty matrix: 1-by-0 v = 2.3893 optOUT = xdmi: 0.2245 xdmiS: 0.1764 corrmx: [ 3x3 double] isf: [1 0 0 0] stset: [-0.1989 -1.1479] z: [1000x1 double] rss: 2.3821e+003 ndf: 997 itc: 2 c=optOUT.xdmi c = 0.2245 [xp,zz,vv]=armasim(x(3:n)-c,par{1},[],x(1:2)-c); max(abs(zz-optOUT.z(3:n))) ans = 8.8818e-016 zz(1:10).',optOUT.z(3:12).' ans = Columns 1 through 7 -1.0032 0.2306 0.7310 -0.9201 0.4399 -1.9294 -0.2368 Columns 8 through 10 -0.5052 1.4159 -0.9299 ans = Columns 1 through 7 -1.0032 0.2306 0.7310 -0.9201 0.4399 -1.9294 -0.2368 Columns 8 through 10 -0.5052 1.4159 -0.9299 diary off