Matlab code to perform the DVV analysis for the case studies stored in *.mat files An example program to perform DVV analysis on some predefined real-valued and complex signals Choose from linear AR(2) signal, nonlinear henon signal, and the real world wind data. 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. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % Matlab code to perform the DVV analysis for the case studies stored in *.mat files 0002 % 0003 % An example program to perform DVV analysis on some predefined real-valued and complex signals 0004 % Choose from linear AR(2) signal, nonlinear henon signal, and the real world wind data. 0005 % 0006 % 0007 % A Delay Vector Variance (DVV) toolbox for MATLAB 0008 % (c) Copyright Danilo P. Mandic 2008 0009 % http://www.commsp.ee.ic.ac.uk/~mandic/dvv.htm 0010 % 0011 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0012 % This program is free software; you can redistribute it and/or modify 0013 % it under the terms of the GNU General Public License as published by 0014 % the Free Software Foundation; either version 2 of the License, or 0015 % (at your option) any later version. 0016 % 0017 % This program is distributed in the hope that it will be useful, 0018 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0019 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0020 % GNU General Public License for more details. 0021 % 0022 % You can obtain a copy of the GNU General Public License from 0023 % http://www.gnu.org/copyleft/gpl.html or by writing to 0024 % Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA. 0025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0026 0027 0028 clc; clear all; close all 0029 0030 % Initializations 0031 % DVV specific parameters 0032 m=3; % embedding parameter 0033 N_DV=200; % number of reference DVs to consider 0034 nd=3; % Span over which to perform DVV 0035 Ntv=50; % number of points on horizontal axes 0036 0037 % Number of surrogates to consider 0038 Ns=25; 0039 0040 % Input: Choose any one of the following input signal for DVV analysis 0041 load ar.mat; % Stored linear AR2 signal 0042 % load henon.mat; % Stored henon signal 0043 % load wind.mat; % Stored 2D/complex wind signal 0044 0045 % DVV analysis of the original time series 0046 disp('Starting DVV analysis on original series ...') 0047 dvv_orig = dvv(X, m, N_DV, nd, Ntv); 0048 % dvv_orig = dvv(X); 0049 0050 % Generates surrogate data 0051 disp('Generating surrogate time series ...') 0052 Xs = surrogate(X, Ns); 0053 0054 % DVV analysis of surrogate data 0055 disp('Starting DVV analysis on Surrogate series ...') 0056 for acc = 1:size(Xs,2) 0057 dvv_surr(:,:,acc) = dvv(Xs(:,acc),m, N_DV, nd, Ntv); 0058 % dvv_surr(:,:,acc) = dvv(Xs(:,acc)); 0059 end 0060 0061 % DVV Plots 0062 figure(1); 0063 plot(dvv_orig(:,1),dvv_orig(:,2),'b-'); grid on; shg; hold on; 0064 title('DVV Plot'); xlabel('std. distance'); ylabel('variance'); 0065 0066 % Mean variance values of surrogates 0067 avg_dvv_surr = mean(dvv_surr,3); 0068 plot(avg_dvv_surr(:,1), avg_dvv_surr(:,2),'r-'); grid on; legend('Original','Surrogates'); shg 0069 0070 % DVV scatter Plots 0071 bisector = 0:0.01:1; 0072 figure(2); 0073 plot(bisector, bisector, 'k-.'); axis([ 0 1 0 1]); 0074 title('DVV Scatter Plot'); xlabel('Original'); ylabel('Surrogates'); grid on; shg; hold on 0075 errorbar(dvv_orig(:,2),avg_dvv_surr(:,2),std(dvv_surr(:,2,:),0,3));