What is wrong with this matlab program?
이전 댓글 표시
I have a homework question about a small-world network. My neuron model is FitzHugh Naguma (electrical coupling). I got this error ??? Error using ==> times Matrix dimensions must agree.
Error in ==> elec_syn_vr_swn at 42 I_syn = ( gsyn.* ( sum((Cshort).*con_mat,2).*x' - con_mat*x' ) )'; and small-world networks matlab codes are true or not? My program is:
%FHN Modeli_VR_Q_e_small-world_networks
clc;clf;clear;
deltat=0.01;
t=250;
j=0;
N=3;
con_mat=ones(N,N)-eye(N); %all-to-all 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;
%SMALL_WORLD NETWORKS
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(n-k+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)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
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*Qvav(2)*sin(w*i*deltat);
Qcos=Qcos+2*Qvav(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');
댓글 수: 1
Walter Roberson
2013년 12월 17일
What difference do you observe between what you expect and what you get? Are you receiving an error message?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!