20 lines
		
	
	
		
			686 B
		
	
	
	
		
			Matlab
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			686 B
		
	
	
	
		
			Matlab
		
	
	
	
	
	
| function spikes = lifspikesoustim(trials, tmax, D, Iou, Dou, tauou )
 | |
| % Generate spike times of a leaky integrate-and-fire neuron with frozen
 | |
| % Ohrnstein-Uhlenbeck stimulus
 | |
| % trials: the number of trials to be generated
 | |
| % tmax: the duration of a trial
 | |
| % D: the strength of additive white noise
 | |
| % Iou: the mean input
 | |
| % Dou: noise strength of the frozen OU noise
 | |
| % tauou: time constant of the OU noise
 | |
|     
 | |
|     dt = 1e-4;
 | |
|     input = zeros(round(tmax/dt), 1);
 | |
|     n = 0.0;
 | |
|     noise = sqrt(2.0*Dou)*randn(length(input), 1)/sqrt(dt);
 | |
|     for i=1:length(noise)
 | |
|         n = n + ( - n + noise(i))*dt/tauou;
 | |
|         input(i) = Iou + n;
 | |
|     end
 | |
|     spikes = lifspikes(trials, input, dt, D );
 | |
| end |