Home > dvv > dvv.m

dvv

PURPOSE ^

Delay Vector Variance method for real and complex signals

SYNOPSIS ^

function data = dvv (X, m, Nsub, nd, Ntv)

DESCRIPTION ^

 Delay Vector Variance method for real and complex signals


 USAGE: C = dvv (X, m, Nsub, nd, Ntv)
    X       original real-valued or complex time series
    m       delay embedding dimension
    Ntv     number of points on horizontal axes
    Nsub    number of reference DVs to consider
    nd      Span over which to perform DVV


   A Delay Vector Variance (DVV) toolbox for MATLAB
   (c) Copyright Danilo P. Mandic 2008
   http://www.commsp.ee.ic.ac.uk/~mandic/dvv.htm

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You can obtain a copy of the GNU General Public License from
   http://www.gnu.org/copyleft/gpl.html or by writing to
   Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function data = dvv (X, m, Nsub, nd, Ntv)    
0002 % Delay Vector Variance method for real and complex signals
0003 %
0004 %
0005 % USAGE: C = dvv (X, m, Nsub, nd, Ntv)
0006 %    X       original real-valued or complex time series
0007 %    m       delay embedding dimension
0008 %    Ntv     number of points on horizontal axes
0009 %    Nsub    number of reference DVs to consider
0010 %    nd      Span over which to perform DVV
0011 %
0012 %
0013 %   A Delay Vector Variance (DVV) toolbox for MATLAB
0014 %   (c) Copyright Danilo P. Mandic 2008
0015 %   http://www.commsp.ee.ic.ac.uk/~mandic/dvv.htm
0016 %
0017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0018 %   This program is free software; you can redistribute it and/or modify
0019 %   it under the terms of the GNU General Public License as published by
0020 %   the Free Software Foundation; either version 2 of the License, or
0021 %   (at your option) any later version.
0022 %
0023 %   This program is distributed in the hope that it will be useful,
0024 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0025 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0026 %   GNU General Public License for more details.
0027 %
0028 %   You can obtain a copy of the GNU General Public License from
0029 %   http://www.gnu.org/copyleft/gpl.html or by writing to
0030 %   Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA.
0031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0032 
0033 % Default parameters
0034 if (nargin<1)
0035     error('Not enough Input arguments');
0036 end
0037 if (nargin<2)
0038     m = 4;
0039 end
0040 if (nargin<3)
0041     Nsub = 200;
0042 end
0043 if (nargin<4)
0044     nd = 2.0;
0045 end
0046 if (nargin<5)
0047     Ntv = 25*nd;
0048 end
0049 
0050 % Initial Conditions
0051 N = length(X);              % Length of input vector
0052 tau = 1;                    % Time delay parameter
0053 d = zeros(N-m*tau, Nsub); 
0054 y = zeros(Ntv,1);
0055 count = 0; 
0056 acc = 0; 
0057 
0058 
0059 % Makes input vector X a column vector
0060 if (size(X,2)>size(X,1))
0061     X = X';
0062 end
0063 
0064 % Generate Nsub subset from existing DV's, randomly
0065 temp = randperm (N - m*tau);
0066 ref = temp(1:Nsub) + m*tau;
0067 
0068 % Computes the pair wise distances b/w reference DV's and all DV's
0069 for i = 1:Nsub
0070     for j = m*tau+1:N
0071             d(j-m*tau,i) = norm (X(ref(i)-m*tau:tau:ref(i)-tau) - X(j-m*tau:tau:j-tau));
0072             if (ref(i) ~= j)
0073                 acc = acc + d(j-m*tau,i); 
0074                 count = count + 1;
0075             end
0076     end
0077 end
0078 
0079 % Mean and std variation calculation of input data
0080 avg = acc/count;
0081 count = 0;
0082 acc = 0;
0083 for i = 1:Nsub
0084     for j = m*tau + 1:N
0085         if (ref(i) ~= j)
0086             acc = acc + (d(j-m*tau,i)-avg).^2; 
0087             count = count + 1;
0088         end
0089     end
0090 end
0091 variance = sqrt(acc/(count-1));
0092 
0093 % Calculates the range vector consisting of Ntv equally spaced regions
0094 n = (1:Ntv)-1;
0095 rd = avg-nd*variance + (2*nd*variance*n)/(Ntv-1);
0096 
0097 % Creates sets of DV's, for each ref element of subset and value rd, which have norms closer than distance rd to ref
0098 for n = 1:length(rd)   
0099     
0100     if (rd(n)>0)
0101         
0102         tot = 0; 
0103         count = 0;        
0104         
0105         for k=1:Nsub
0106             
0107             IND = find(d(:,k) <= rd(n)) + m*tau;
0108             IND = IND(IND~=k);
0109 
0110             
0111             % Only those variance values are considered for which the corresponding
0112             % sets have atleast 30 DVs
0113             if (length(IND) >= 30)
0114                 tot = tot + var(X(IND));                 
0115                 count = count+1;
0116             end
0117             
0118         end    
0119         
0120         if (~count)
0121             y(n) = NaN;
0122         else
0123             y(n) = tot/(count*var(X));
0124         end
0125         
0126     else
0127         y(n) = NaN;
0128     end
0129     
0130 end
0131 
0132 % Horizontal axis
0133 T = (rd'-avg)/variance;
0134 
0135 % DVV Output
0136 data = [T y];
0137

Generated on Wed 15-Oct-2008 17:26:01 by m2html © 2003