-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspm_dcm_fmri_mode_gen.m
31 lines (26 loc) · 1.1 KB
/
spm_dcm_fmri_mode_gen.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function [Ep,Cp] = spm_dcm_fmri_mode_gen(Ev,modes,Cv)
% Generates adjacency matrix for spectral DCM from Lyapunov exponents
% FORMAT [Ep,Cp] = spm_dcm_fmri_mode_gen(Ev,modes,Cv)
% Ev - Lyapunov exponents or eigenvalues of effective connectivity
% modes - modes or eigenvectors
% Cv - optional (posterior) covariance matrix
%
% Ep - Jacobian or (symmetric) effective connectivity matrix
% Cp - posterior covariance matrix of Jacobian elements
%
% This routine computes the connecivity graph for spectral DCM (modes).
%__________________________________________________________________________
% Copyright (C) 2014 Wellcome Trust Centre for Neuroimaging
% Karl Friston
% $Id: spm_dcm_fmri_mode_gen.m 5823 2014-01-02 14:01:10Z guillaume $
% outer product
%==========================================================================
Ep = modes*diag(-exp(-Ev))*modes';
if nargout == 1, return, end
% covariance
%==========================================================================
dAdv = spm_diff(@spm_dcm_fmri_mode_gen,Ev,modes,1);
for i = 1:length(dAdv)
G(:,i) = dAdv{i}(:);
end
Cp = G*Cv*G';