1 function [AutoCov,AutoCorr,MX,E,NC]=invest0(Y,Pmax,Mode);
2 % First Investigation of a signal (time series) - automated part
3 % [AutoCov,AutoCorr,ARPMX,E,ACFsd,NC]=invest0(Y,Pmax);
5 % [AutoCov,AutoCorr,ARPMX,E,ACFsd,NC]=invest0(AutoCov,Pmax,Mode);
9 % Pmax maximal order (optional)
11 % AutoCov Autocorrelation
12 % AutoCorr normalized Autocorrelation
13 % PartACF Partial Autocorrelation
14 % ARPMX Autoregressive Parameter for order Pmax-1
15 % E Error function E(p)
16 % NC Number of values (length-missing values)
19 % P.J. Brockwell and R.A. Davis "Time Series: Theory and Methods", 2nd ed. Springer, 1991.
20 % M.S. Grewal and A.P. Andrews "Kalman Filtering" Prentice Hall, 1993.
21 % S. Haykin "Adaptive Filter Theory" 3ed. Prentice Hall, 1996.
22 % M.B. Priestley "Spectral Analysis and Time Series" Academic Press, 1981.
23 % W.S. Wei "Time Series Analysis" Addison Wesley, 1990.
25 % $Id: invest0.m 7687 2010-09-08 18:39:23Z schloegl $
26 % Copyright (C) 1998-2003,2008,2010 by Alois Schloegl <a.schloegl@ieee.org>
27 % This is part of the TSA-toolbox. See also
28 % http://biosig-consulting.com/matlab/tsa/
30 % This program is free software: you can redistribute it and/or modify
31 % it under the terms of the GNU General Public License as published by
32 % the Free Software Foundation, either version 3 of the License, or
33 % (at your option) any later version.
35 % This program is distributed in the hope that it will be useful,
36 % but WITHOUT ANY WARRANTY; without even the implied warranty of
37 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38 % GNU General Public License for more details.
40 % You should have received a copy of the GNU General Public License
41 % along with this program. If not, see <http://www.gnu.org/licenses/>.
50 NC = sumskipnan(real(~isnan(Y)),2); % number of valid components (data points)
53 if nargin<2, Pmax = min([100 nc/3]); end;
63 AutoCorr = AutoCov(:,2:M+1)./AutoCov(:,ones(M,1));
65 if 1,Pmax<100; % this needs change of sinvest1
67 [MX,E]=lattice(Y,Pmax);
68 %[MX,E]=ulsar(Y,Pmax);
69 %[MX,E]=durlev(AutoCov);
70 % ARP=MX(:,K*(K-1)/2+(1:K));
71 % PartACF =MX(:,(1:K).*(2:K+1)/2);
73 [ARP,RC,E]=lattice(Y,Pmax);
74 %[ARP,PartACF,E]=durlev(AutoCov);