# Stimulus / rate reconstruction with Wiener Kernels.

1. Jan 17, 2014

### Beserra

Hello.

I am having some trouble trying to reconstruct my firing rates using a Volterra expansion.
Basically it is known that , if :
s(t) = the value of a given stimulus at time t
r(t) = the firing rate of a neuron at time t

then we assume that a possible estimate of the firing rate can be achieved by
rest(t) = r_0 + ∫dτ D(τ)s(t-τ) where D(τ) is the Wiener Kernel.

Then the condition for the best estimate rest(t) is achieved when
FD(ω)*FQss(ω) = FQrs(-ω) . Where FA denotes the fourier transform of a function A.

While I understand all this mathematically I can not apply it using Matlab.
I have s as a vector of positions of a given stimulus and rg as a vector of
rates of a neuron .

Then I make
QSS = xcorr(S,S);
QrS = xcorr(rg,S);
FQSS = fft(QSS);
FQrS = fft(QrS);
G = FQrS(length(FQrS):-1:1); % G(ω) = FQrS(-ω) because xcorr seems to put the t = 0
%at the middle of the vector
FD = G./FQSS'
D = ifft(FD);

When I make 'rest' proportional to 'conv(D, S)' I obtain not my firing rates but rather
a very similar version of my own stimulus S.

What am I doing wrong? Thanks!

Beserra

2. Jan 17, 2014

### Beserra

I forgot to specify that Qab denotes the cross correlation function of a and b