I have a matlab program about smallworld network. My neuron model is FitzHugh Naguma and electrical coupling (three coupled neuron) I want to apply smallworld network to this neuron model. my matlab programme is:
Can you help me what is wrong with it?
%FHN Modeli_VR_Q_e_smallworld_networks
clc;clf;clear;
deltat=0.01;
t=250;
j=0;
N=3;
con_mat=ones(N,N)eye(N); %alltoall network
for B=0.0:0.001:0.04
B
a=1.01;
j=j+1;
e=0.01;
A=0.01;
ohm=5;
w=0.1;
x=0.8*ones(1,3);
y=0.2*ones(1,3);
Isyn=zeros(1,3);
gsyn=0.1;
Qsin=0;
Qcos=0;
%SMALLWORLD NETWORK
n=50;%number of nodes
k=4;%the nearest neighbor
p=0.5;%coupling probability
r=zeros(1,n);r(2:k+1)=1;r(nk+1:n)=1;
C=toeplitz(r)
%subplot(2,2,1), spy(C)
%subplot(2,2,2)
v=find(rand(n,1)< p);
Cshort=sparse(v,ceil(n*rand(size(v))),ones(size(v)),n,n)
for i=1:t/deltat
x=x+deltat.*(x  x.^3/3 y Isyn)./e;
y=y+deltat.*(x +a +A.*cos(w*i*deltat) +B*cos(ohm*i*deltat) );
I_syn = ( gsyn.* ( sum((Cshort)'.*con_mat,2).*x'  con_mat*x' ) )';
Qv=x;
Qv(find(Qv<0))=1;
Qvav=(1/n)*sum(Qv);
Qsin=Qsin+2*Qav(2)*sin(w*i*deltat);
Qcos=Qcos+2*Qav(2)*cos(w*i*deltat);
end
Qsin=Qsin/(t/deltat);
Qcos=Qcos/(t/deltat);
Qson(j)=sqrt(Qsin^2+Qcos^2);
end
Bplot=0.0:0.001:0.04;
plot(Bplot,Qson,'o'),
grid on;
xlabel('B');
ylabel('Q');
