π» Coding Mission
NumPy Population Simulation
Click Run to start Python
Simulate N=50 neurons using a 2D NumPy array and plot mean Β± std. Your task: 1. V = np.zeros((N, T)) where N=50, T=int(t_max/dt)=150 2. Set initial condition: V[:, 0] = el 3. Double loop β outer over neurons, inner over time steps (range(T-1)) 4. Update: V[n, t_step+1] = V[n, t_step] + (dt/tau)*(el - V[n,t_step] + r*i_t) 5. Spike reset: if V[n, t_step+1] >= vth: V[n, t_step+1] = vr 6. After loop: - v_mean = np.mean(V, axis=0) * 1000 (mV) - v_std = np.std(V, axis=0) * 1000 (mV) 7. Plot mean line + shaded Β±std band with ax.fill_between()
Hints (only if you're stuck!)
solution.py
β Loading...