Why do we need the flag variable? p=1 ISI q=1 i= flag= 1 0 The simulation iterates looking for the first place to start a spike. Suppose p=1 is the iteration of the last peak and that the (ISI) refractory period is 5 milliseconds (ms) and timestep is 1 ms. Suppose we set flag=0 to mean we are in the refractory period and flag=1 to mean we are in the rising spike. Why do we need the flag variable? The test used: timestep*(i­p) < ISI succeed p=1 ISI q=1 i= flag= 1 2 0 0 The simulation iterates looking for the first place to start a spike. Suppose p=1 is the iteration of the last peak and that the (ISI) refractory period is 5 milliseconds (ms) and timestep is 1 ms. Suppose we set flag=0 to mean we are in the refractory period and flag=1 to mean we are in the rising spike. Why do we need the flag variable? The test used: timestep*(i­p) < ISI succeed p=1 ISI q=1 i= flag= 1 2 3 0 0 0 The simulation iterates looking for the first place to start a spike. Suppose p=1 is the iteration of the last peak and that the (ISI) refractory period is 5 milliseconds (ms) and timestep is 1 ms. Suppose we set flag=0 to mean we are in the refractory period and flag=1 to mean we are in the rising spike. Why do we need the flag variable? The test used: timestep*(i­p) < ISI succeed p=1 ISI q=1 i= flag= 1 2 3 4 0 0 0 0 The simulation iterates looking for the first place to start a spike. Suppose p=1 is the iteration of the last peak and that the (ISI) refractory period is 5 milliseconds (ms) and timestep is 1 ms. Suppose we set flag=0 to mean we are in the refractory period and flag=1 to mean we are in the rising spike. Why do we need the flag variable? The test used: timestep*(i­p) < ISI succeed p=1 ISI q=1 i= flag= 1 2 3 4 5 0 0 0 0 0 The simulation iterates looking for the first place to start a spike. Suppose p=1 is the iteration of the last peak and that the (ISI) refractory period is 5 milliseconds (ms) and timestep is 1 ms. Suppose we set flag=0 to mean we are in the refractory period and flag=1 to mean we are in the rising spike. Why do we need the flag variable? The test used: timestep*(i­p) < ISI fail p=1 ISI q=1 i= flag= 1 2 3 4 5 6 0 0 0 0 0 0 The simulation iterates looking for the first place to start a spike. Suppose p=1 is the iteration of the last peak and that the (ISI) refractory period is 5 milliseconds (ms) and timestep is 1 ms. Suppose we set flag=0 to mean we are in the refractory period and flag=1 to mean we are in the rising spike. Why do we need the flag variable? The test used: timestep*(i­p) < ISI fail flag == 0 success p=1 ISI q=1 i= flag= 1 2 3 4 5 6 0 0 0 0 0 0 The simulation iterates looking for the first place to start a spike. Suppose p=1 is the iteration of the last peak and that the (ISI) refractory period is 5 milliseconds (ms) and timestep is 1 ms. Suppose we set flag=0 to mean we are in the refractory period and flag=1 to mean we are in the rising spike. Why do we need the flag variable? The test used: timestep*(i­p) < ISI fail flag == 0 success p=1 ISI q=1 i= flag= We located the start of a spike: we are outside the refractory period but flag = 0 1 2 3 4 5 6 0 0 0 0 0 0 The simulation iterates looking for the first place to start a spike. Suppose p=1 is the iteration of the last peak and that the (ISI) refractory period is 5 milliseconds (ms) and timestep is 1 ms. Suppose we set flag=0 to mean we are in the refractory period and flag=1 to mean we are in the rising spike. Why do we need the flag variable? The test used: timestep*(i­p) < ISI fail flag == 0 success p=1 ISI q=1 i= flag= Set q=i Vneuron(i)=0; flag=1; 1 2 3 4 5 6 0 0 0 0 0 0 The simulation iterates looking for the first place to start a spike. Suppose p=1 is the iteration of the last peak and that the (ISI) refractory period is 5 milliseconds (ms) and timestep is 1 ms. Suppose we set flag=0 to mean we are in the refractory period and flag=1 to mean we are in the rising spike. Why do we need the flag variable? The test used: timestep*(i­p) < ISI fail flag == 0 success p=1 q=6 i= flag= Set q=i Vneuron(i)=0; flag=1; 1 2 3 4 5 6 0 0 0 0 0 0 The simulation iterates looking for the first place to start a spike. Suppose p=1 is the iteration of the last peak and that the (ISI) refractory period is 5 milliseconds (ms) and timestep is 1 ms. Suppose we set flag=0 to mean we are in the refractory period and flag=1 to mean we are in the rising spike. Why do we need the flag variable? The test used: timestep*(i­p) < ISI fail flag == 0 success p=1 q=6 i= flag= 1 2 3 4 5 6 0 0 0 0 0 0 The simulation iterates looking for the first place to start a spike. Suppose p=1 is the iteration of the last peak and that the (ISI) refractory period is 5 milliseconds (ms) and timestep is 1 ms. Suppose we set flag=0 to mean we are in the refractory period and flag=1 to mean we are in the rising spike. Why do we need the flag variable? The test used: timestep*(i­p) < ISI fail flag == 0 fail Vneuron(i) >= Vthr fail p=1 Vthr q=6 i= flag= 1 2 3 4 5 6 7 0 0 0 0 0 0 1 q stays at 6 because flag is 1 – then we can compute Vneuron(i)from (1­exp(­Dt/RC))*Vcc The simulation iterates looking for the first place to start a spike. Suppose p=1 is the iteration of the last peak and that the (ISI) refractory period is 5 milliseconds (ms) and timestep is 1 ms. Suppose we set flag=0 to mean we are in the refractory period and flag=1 to mean we are in the rising spike. Why do we need the flag variable? The test used: timestep*(i­p) < ISI fail flag == 0 fail Vneuron(i) >= Vthr fail p=1 Vthr q=6 i= flag= 1 2 3 4 5 6 7 8 0 0 0 0 0 0 1 1 q stays at 6 because flag is 1 – then we can compute Vneuron(i)from (1­exp(­Dt/RC))*Vcc The simulation iterates looking for the first place to start a spike. Suppose p=1 is the iteration of the last peak and that the (ISI) refractory period is 5 milliseconds (ms) and timestep is 1 ms. Suppose we set flag=0 to mean we are in the refractory period and flag=1 to mean we are in the rising spike. Why do we need the flag variable? The test used: timestep*(i­p) < ISI fail flag == 0 fail Vneuron(i) >= Vthr success p=9 Vthr Set p =i; flag=0; q=6 Vneuron(i)=0; i= flag= 1 2 3 4 5 6 7 8 9 0 0 0 0 0 0 1 1 0 The simulation iterates looking for the first place to start a spike. Suppose p=1 is the iteration of the last peak and that the (ISI) refractory period is 5 milliseconds (ms) and timestep is 1 ms. Suppose we set flag=0 to mean we are in the refractory period and flag=1 to mean we are in the rising spike. Why do we need the flag variable? The test used: timestep*(i­p) < ISI success Vthr p=9 ISI q=6 i= flag= 1 2 3 4 5 6 7 8 9 10 0 0 0 0 0 0 1 1 0 0 The simulation iterates looking for the first place to start a spike. Suppose p=1 is the iteration of the last peak and that the (ISI) refractory period is 5 milliseconds (ms) and timestep is 1 ms. Suppose we set flag=0 to mean we are in the refractory period and flag=1 to mean we are in the rising spike. Why do we need the flag variable? The test used: timestep*(i­p) < ISI success Vthr p=9 ISI q=6 i= flag= 1 2 3 4 5 6 7 8 9 10 11 0 0 0 0 0 0 1 1 0 0 0 The simulation iterates looking for the first place to start a spike. Suppose p=1 is the iteration of the last peak and that the (ISI) refractory period is 5 milliseconds (ms) and timestep is 1 ms. Suppose we set flag=0 to mean we are in the refractory period and flag=1 to mean we are in the rising spike. Why do we need the flag variable? The test used: timestep*(i­p) < ISI success Vthr p=9 ISI q=6 ... i= flag= 1 2 3 4 5 6 7 8 9 10 11 0 0 0 0 0 0 1 1 0 0 0 The simulation iterates looking for the first place to start a spike. Suppose p=1 is the iteration of the last peak and that the (ISI) refractory period is 5 milliseconds (ms) and timestep is 1 ms. Suppose we set flag=0 to mean we are in the refractory period and flag=1 to mean we are in the rising spike.