Changing input variable ode23

조회 수: 1 (최근 30일)
Maarten Duijn
Maarten Duijn 2020년 6월 23일
댓글: darova 2020년 6월 25일
Dear all,
I'm simulating a QIF-model for spiking neurons with a discrete resetting rule.
The code is added below.
close all
clc
%Firing rate equations for 2 neural masses with only electrical coupling
%& chemical coupling. N=10000
I_1= 0;
I_2= 0.5*pi;
params.tau= 10;
params.g= 2.2;
params.delta= 100;
params.J.GPe= 1.4 ;
params.J.STN= 1.4;
N= 10000;
V_1= -65;
R_1= 0;
V_2= -65;
R_2= 0;
I= [I_1;I_2];
y0=[V_1,V_2,R_1,R_2];
options = odeset('Events',@QIF_reset)
tstart=0
tfinal= 20000
tout=tstart
yout = y0;
teout = [];
yeout = [];
ieout = [];
for i = 1:13
% Solve until the first terminal event.
[t,y,te,ye,ie] = ode23(@(t,y)QIF(t,y,I,params,N),[tstart tfinal],y0,options);
if ~ishold
hold on
end
% Accumulate output. This could be passed out as output arguments.
nt = length(t);
tout = [tout; t(2:nt)];
yout = [yout; y(2:nt,:)];
teout = [teout; te]; % Events at tstart are never reported.
yeout = [yeout; ye];
ieout = [ieout; ie];
[row,col] = find(ye>99);
% Set the new initial conditions, with .9 attenuation.
y0(1) = ye(1);
y0(2) = ye(2);
y0(3) = ye(3);
y0(4) = ye(4);
y0(col)= -65;
y0(col+2)= 0;
% A good guess of a valid first timestep is the length of the last valid
% timestep, so use it for faster computation. 'refine' is 4 by default.
tstart = t(nt);
end
figure(1);
plot(tout,yout(:,1),'b',tout,yout(:,3),'k')
xlabel 'Time in ms'
ylabel 'Mean membrane potential'
title 'Mean membrane potential STN'
hold off
figure(2)
plot(tout,yout(:,2),'b',tout,yout(:,4),'k')
xlabel 'Time in ms'
ylabel 'Mean membrane potential'
title 'Mean membrane potential GPe'
hold off
The problem is that I would love to evaluate this model with varying Input.
Is that possible and if so how should the for loop look like?
  댓글 수: 3
Maarten Duijn
Maarten Duijn 2020년 6월 24일
I_1 and I_2 are the inputs for the neural populations.
I would to have a sinusiodal input for I_2 while keeping I_1 at 0.
darova
darova 2020년 6월 25일
  • I_1 and I_2
can't see them

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Neural Simulation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by