echo on format compact % DEMONSTRACE ODHADU PARAMETRU SIMULOVANEHO PROCESU AR(2) %======================================================== close all % GENEROVANI PROCESU %----------------------------------------------------------------------------- p=2; n=1000; sigma2=2.25; sigma=sqrt(sigma2); [x,phir,thetar]=armagen([0.5,0.2],[],n+10,sigma); xx=x(n-p+1:n+10); % Poledni dve + 10 budoucich pozorovanych hodnot x=x(1:n) ; % Dosud pozorovane hodnoty % ODHAD AUTOKOVARIANCNI FUNKCE [xro,xroE,mi,miE,xacf]=acf(x,figure); pause; %----------------------------------------------------------------------------- % ODHAD PARCIALNI AUTOKOVARIANCNI FUNKCE A PARAMETRU PROCESU [xpacf,phi]=pacf(xacf,n,figure); more on phi.' % ODHAD PARAMETRU more off pause; %----------------------------------------------------------------------------- % ZAVERECNY ODHAD S ODHADNUTYM RADEM p=2 [xpacf,phi,phiE,v]=pacf(xacf(1:p+1),n); [phi,phiE].' % ZAVERECNY ODHAD PARAMETRU a jejich konfidencni polosirky v % ZAVERECNY ODHAD ROZPTYLU sigma2 pause; %-----------------------------------------------------------------------------%----------------------------------------------------------------------------- % VYHLAZENA PREDIKCE xs = [x(n-p+1:n);armagen([0.5,0.2],[],10,0,x(n-p+1:n))]; % IDEALNI VYHLAZENI xse= [x(n-p+1:n);armagen( phi(1:p),[],10,0,x(n-p+1:n))]; % ODHADNUTE VYHLAZENI t=(n-p+1:n+10).'; figure;plot(t,xs,'w',t,xse,'y--') title('Vyhlazena predikce'); pause; %-----------------------------------------------------------------------------% PREDIKCE POMOCI ODHADU % ODHAD PREDIKCE VCETNE SUMU xxe=[x(n-p+1:n);armagen(phi(1:2),[],10,sqrt(v),x)]; figure;plot(t,xx,'w',t,xxe,'y--') title('Odhad predikce vcetne sumu c.1'); pause; %----------------------------------------------------------------------------- % JESTE JEDNOU SE ZNOVU GENEROVANYMI BUDOUCIMI HODNOTAMI xx = [x(n-p+1:n);armagen([0.5,0.2],[],10,sigma ,x)]; xxe= [x(n-p+1:n);armagen(phi(1:2) ,[],10,sqrt(v),x)]; figure;plot(t,xx,'w',t,xxe,'y--') title('Odhad predikce vcetne sumu c.2'); pause; % OPAKUJTE NEKOLIKRAT echo off