This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % Apply filter | |
| for idx = 1:m-1 | |
| temp_signal = conv(s(:,idx), k); | |
| f(:,idx) = highpass(s(:,idx), tau, dt) + temp_signal; | |
| end | |
| % Add DC | |
| f = f + dc * s; | |
| % ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %% Power spectrum demo | |
| clear all; | |
| dt = 0.01; | |
| % Ten seconds at dt=0.01 | |
| t = 0:dt:10; | |
| % Frequencies to be included in the signal. NB: Due |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function [output] = generate_stimulus(stimulus_type) | |
| n_spatial = 180; | |
| timesteps = 5000; | |
| precision = 6000; | |
| output = zeros(n_spatial, timesteps); | |
| switch stimulus_type | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % EXERCISE SET 5 -- Part I | |
| close all; | |
| clear all; | |
| %% Parameters | |
| dt = 0.001; % s | |
| dur = 1; % s | |
| t = 0:dt:dur; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %% EXERCISE 4 -- PART I: Firing rate estimation | |
| clear all; | |
| %% Parameters | |
| rate = 40; % in Hz | |
| dt = 0.001; % Time step in s | |
| duration = 5; % in s | |
| % NB, these are VERY wide kernels |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function sta = spike_triggered_avg(spikes, stimulus, winlen) | |
| slices = arrayfun(@(x) stimulus(x-winlen:x-1), ... | |
| find(spikes(winlen:end)) + winlen, ... | |
| 'UniformOutput', 0); | |
| sta = mean(cat(2, slices{:}), 2); | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Implementation of Hodgkin-Huxley model | |
| # v2 | |
| import matplotlib.pyplot as plt | |
| from numpy import * | |
| from scipy import * | |
| # Spike counting |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def decorated(func): | |
| def r_func(*args, **kwargs): | |
| print "Decorated call." | |
| return func(*args, **kwargs) | |
| return r_func | |
| @decorated | |
| def double(x): |
NewerOlder