-
Notifications
You must be signed in to change notification settings - Fork 0
/
sA2soln.m
59 lines (48 loc) · 1.57 KB
/
sA2soln.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
function soln = sA2soln(sA,T,X0,epsilon,delta,theta)
% function soln = sA2soln(sA,T,X0,epsilon,delta,theta)
%
% sA = n x n binary adjacency matrix for a directed graph
% T = length of time for ode solution, in units of leak timescale tau
% -> default is T=70
% X0 = n x 1 vector of initial conditions (default is random near all-zeros)
% epsilon/delta are the values for weights -1+epsilon, -1-delta in W
% -> defaults are those from graph2net.m
% theta = n x 1 vector of external stimulus or scalar value
%
% Note: theta = b in threshlin_ode, and T is also passed directly
% to threshlin_ode, so added flexibility there applies. In particular
% we can have theta change values to make a pulse train of "kicks."
%
% calls: graph2net.m and threshlin_ode.m
% last modified Aug 8, 2020, to change defaults to match quick_plot ones
% modified Aug 16, 2023 to revert to e=0.25 and d=0.5 defaults
n = size(sA,1); % no. of neurons
if nargin < 2 || isempty(T)
T = 70;
end;
if nargin < 3 || isempty(X0)
X0 = zeros(n,1) + .01*rand(n,1); % break symmetry on init conds
end;
if nargin < 4 || isempty(epsilon)
epsilon = 0.25;
end;
if nargin < 5 || isempty(delta)
delta = 0.5;
end;
if nargin < 6 || isempty(theta)
theta = 1;
end;
% create network W from sA
W = graph2net(sA,epsilon,delta);
% create external input vector b from theta
if length(theta) == 1
b = theta*ones(n,1);
else
b = theta;
end;
% simulate activity with constant b and initial conds X0
soln = threshlin_ode(W,b,T,X0);
% add adjacency matrix to soln struct
soln.sA = sA;
soln.eps = epsilon;
soln.delta = delta;