Home > vbmeg > functions > tool_box > linear_connectome_dynamics_toolbox > lcd_calc_residuals.m

lcd_calc_residuals

PURPOSE ^

COMPUTE RESIDUALS OF MAR MODEL

SYNOPSIS ^

function uu = lcd_calc_residuals(J,conMAR,xx0)

DESCRIPTION ^

 COMPUTE RESIDUALS OF MAR MODEL

 [Input]
 J    : timeseries data [Nv Nt]
 conMAR : concatenated MAR matrix [Nv Nv*dmax]
 xx0    : initial values 

 [Output]
 uu : residual timeseries [Nv Nt] 

 2016/01/28 O.Yamashita

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function uu = lcd_calc_residuals(J,conMAR,xx0)
0002 % COMPUTE RESIDUALS OF MAR MODEL
0003 %
0004 % [Input]
0005 % J    : timeseries data [Nv Nt]
0006 % conMAR : concatenated MAR matrix [Nv Nv*dmax]
0007 % xx0    : initial values
0008 %
0009 % [Output]
0010 % uu : residual timeseries [Nv Nt]
0011 %
0012 % 2016/01/28 O.Yamashita
0013 
0014 [Nvertex,Nt] = size(J);
0015 [tmp, Nall] = size(conMAR);
0016 dmax = Nall/Nvertex;
0017 
0018 if nargin < 3
0019     xx0 = zeros(Nvertex,dmax);
0020 end
0021 
0022 % compute residuals
0023 u = zeros(Nvertex,Nt+dmax);
0024 x = [xx0 J];
0025 
0026 for tt = dmax+1 : Nt+dmax
0027     if mod(tt,100)==0, fprintf('%02d ',tt); end
0028     x0 = x(:,tt-1:-1:tt-dmax);   
0029     x0 = x0(:);
0030     u(:,tt) = x(:,tt) - conMAR*x0;
0031          
0032 end
0033 fprintf('\n');
0034 
0035 uu = u(:,dmax+1:end);

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005