ssa
1function Acf = AcfMed(lagS,win,TS)
2% lagS - ïàðàìåòð ïîãðóæåíèÿ âðåìåííîãî ðÿäà (ÂÐ) TS â òðàåêòîðíîå ïðîñòðàíñòâî
3% win - êîëè÷åñòâî îòñ÷åòîâ ÂÐ TS
4% TS - ÂÐ, ñîäåðæàùèé win îòñ÷åòîâ
5Y = zeros(win-lagS+1,lagS); % òðàåêòîðíàÿ ìàòðèöà ÂÐ TS
6for m=1:lagS
7Y(:,m) = TS(m:win-lagS+m); % m-é ñòîëáåö òðàåêòîðíîé ìàòðèöà ÂÐ TS
8end
9Cor = Y'*Y; % lagS*lagS ìàòðèöà êîððåëÿö-õ ïðîèçâåäåíèé
10lon = lagS;
11CorPro(1:lon) = diag(Cor); % ÂÐ êîððåëÿö-ãî ïðîèçâåäåíèÿ äëÿ ëàãà 0
12Acf(1) = median(CorPro(1:lon)); % ìåäèàíà ãëàâíîé äèàãîíàëè CorPro
13for m=2:lagS
14lon = lon-1;
15CorPro(1:lon) = diag(Cor,m-1); % ÂÐ êîððåëÿö-ãî ïðîèçâåäåíèÿ äëÿ ëàãà m-1
16if m<=lagS
17Acf(m) = median(CorPro(1:lon))/Acf(1); % ìåäèàí-ÿ îöåíêà íîðìèðîâàííîé ÀÊÔ
18end
19end
20Acf(1) = 1.0;
21end