-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_A.m
35 lines (32 loc) · 985 Bytes
/
create_A.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
function A=create_A(EE,EI,IE,II,Ne,Ni)
% rng('shuffle')
% Probability of connection to each neuron is between 0 and 1
% based on number of Ne and Ni each neuron recieve specefic number of
% connections.
% 1st input: excitatory->excitatory
% 2nd input: excitatory->inhibitory
% 3rd input: inhibitory->excitatory
% 4th input: inhibitory->inhibitory
% 5th input: Number of excitatory neuron(s)
% 6th input: Number of inhibitory neuron(s)
probab_exci_exci=round(EE*Ne);
probab_exci_inhi=round(EI*Ne);
probab_inhi_exci=round(IE*Ni);
probab_inhi_inhi=round(II*Ni);
N=Ne+Ni;
A=zeros(Ne+Ni);
for ii=1:Ne % ii is Post
X=randperm(Ne,probab_exci_exci); % X is Pre
A(ii,X)=1;
Y=randperm(Ni,probab_inhi_exci); %Y is Pre
A(ii,Ne+Y)=1;
end
for ii=Ne+1:Ni+Ne %ii is Post
X=randperm(Ne,probab_exci_inhi); %X is Pre
A(ii,X)=1;
Y=randperm(Ni,probab_inhi_inhi); %Y is Pre
A(ii,Ne+Y)=1;
end
C=eye(N,N);
A=A.*(~C);
end