Last active
November 26, 2017 08:54
-
-
Save leon-nn/151d1755d07e5876be698e82fda47117 to your computer and use it in GitHub Desktop.
Ornstein-Uhlenbeck Process
This file contains 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
%% Ornstein-Uhlenbeck Process | |
% ...from the paper "FLUCTUATING SYNAPTIC CONDUCTANCES RECREATE IN | |
% VIVO-LIKE ACTIVITY IN NEOCORTICAL NEURONS" | |
% The stochastic differential equation is given by: | |
% dx/dt = 1/tau * (mu - x) + sqrt(D) * chi(t) | |
% where: | |
% x is the random variable | |
% D is the amplitude of the stochastic component | |
% chi(t) is a normally-distributed (zero-mean) noise source | |
% tau is the time constant (tau = 0 gives white noise, tau > 0 gives | |
% colored noise) | |
% x is Gaussian and its variance is given by: | |
% sigma^2 = D * tau / 2 | |
% Therefore the SDE can also be expressed as: | |
% dx/dt = 1/tau * (mu - x) + sigma * sqrt(2/tau) * chi(t) | |
% Use a time constant of 5 ms, a variance of 2500, a mean of 250 | |
tau = 5; | |
sigma = sqrt(2500); | |
mu = 250; | |
% Consider dt = 1 | |
tSim = 10000; | |
x = zeros(tSim, 1); | |
for i = 1: tSim - 1 | |
x(i + 1) = x(i) + 1/tau * (mu - x(i)) + sigma * sqrt(2/tau) * randn(1); | |
end | |
% The variance seems to be off. Why? | |
mean(x) | |
var(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment