Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Convoluting a train of impulses

Subject: Convoluting a train of impulses

From: Jose

Date: 26 Jan, 2009 17:34:02

Message: 1 of 5

Someone can help me how can I convolve a train of impulses generated by a gamma function with a gaussian kernel?
Cheers,
Jose.

Subject: Convoluting a train of impulses

From: Jomar Bueyes

Date: 26 Jan, 2009 17:43:41

Message: 2 of 5

On Jan 26, 12:34=A0pm, "Jose " <jose.l.v...@gmail.com> wrote:
> Someone can help me how can I convolve a train of impulses generated by a=
 gamma function =A0with a gaussian kernel?
> Cheers,
> Jose.

Hi Jose,

The convolution of a train of impulses with a Gaussian kernel is the
sum of a sequence of Gaussian kernels each with it center shifted to
the location of a pulse in the train. With enough zero-padding on the
Gaussian kernel you could use the Matlab circshift function to
position the kernel before adding it to an accumulator. However, if
the sequence of pulses is long, you might be better off using FFTs to
do the convolution.

HTH,

Jomar

Subject: Convoluting a train of impulses

From: Jose

Date: 26 Jan, 2009 17:53:01

Message: 3 of 5

Jomar Bueyes <jomarbueyes@hotmail.com> wrote in message <6531e450-ee83-4546-aea0-96e1053032f8@i20g2000prf.googlegroups.com>...
> On Jan 26, 12:34=A0pm, "Jose " <jose.l.v...@gmail.com> wrote:
> > Someone can help me how can I convolve a train of impulses generated by a=
> gamma function =A0with a gaussian kernel?
> > Cheers,
> > Jose.
>
> Hi Jose,
>
> The convolution of a train of impulses with a Gaussian kernel is the
> sum of a sequence of Gaussian kernels each with it center shifted to
> the location of a pulse in the train. With enough zero-padding on the
> Gaussian kernel you could use the Matlab circshift function to
> position the kernel before adding it to an accumulator. However, if
> the sequence of pulses is long, you might be better off using FFTs to
> do the convolution.
>
> HTH,
>
> Jomar

Hi Jomar,
Please could you write down a little code with it using the circshift function
(i am not interested in fft) after the spike train z i have written down below:
Thanks in advance,

%Here you are the gamma process:

isi=round(gamrnd(4,100/4,1,1000)); %this generates a gamma ISI of mean
%isi 100ms and order 4;
spk=cumsum(isi);
spk=spk(spk<1000);
z=zeros(1,1000);
z(spk)=1;
Jose.

Subject: Convoluting a train of impulses

From: Jomar Bueyes

Date: 26 Jan, 2009 18:06:27

Message: 4 of 5

On Jan 26, 12:53=A0pm, "Jose " <jose.l.v...@gmail.com> wrote:
> Jomar Bueyes <jomarbue...@hotmail.com> wrote in message <6531e450-ee83-45=
46-aea0-96e105303...@i20g2000prf.googlegroups.com>...
> > On Jan 26, 12:34=3DA0pm, "Jose " <jose.l.v...@gmail.com> wrote:
> > > Someone can help me how can I convolve a train of impulses generated =
by a=3D
> > =A0gamma function =3DA0with a gaussian kernel?
> > > Cheers,
> > > Jose.
>
> > Hi Jose,
>
> > The convolution of a train of impulses with a Gaussian kernel is the
> > sum of a sequence of Gaussian kernels each with it center shifted to
> > the location of a pulse in the train. With enough zero-padding on the
> > Gaussian kernel you could use the Matlab circshift function to
> > position the kernel before adding it to an accumulator. =A0However, if
> > the sequence of pulses is long, you might be better off using FFTs to
> > do the convolution.
>
> > HTH,
>
> > Jomar
>
> Hi Jomar,
> Please could you write down a little code with it using the circshift fun=
ction
> (i am not interested in fft) after the spike train z i have written down =
below:
> Thanks in advance,
>
> %Here you are the gamma process:
>
> isi=3Dround(gamrnd(4,100/4,1,1000)); %this generates a gamma ISI of mean
> %isi 100ms and order 4;
> spk=3Dcumsum(isi);
> spk=3Dspk(spk<1000);
> z=3Dzeros(1,1000);
> z(spk)=3D1;
> Jose.

Hi Jos=E9

Assume that gk() is your Gaussian kernel with the maximum at gk(1) and
with the negative part wrapped to the upper end of the array (that is
Gaussian(-1) is stored in gk(end), Gaussian(-2) stored in gk
(end-1), ..., Gaussian(-k) stored in gk(end-k+1)) and that there is
enough zero padding in the middle of the gk array. Also assume that sl
() is an array with the locations of the impulses

> acc =3D zeros(size(gk)); % or other appropriate size for your problem

then for each impulse location sl(k) you add a shifted Gaussian to the
accumulator

> acc =3D acc + circshift(gk, sl(k)); % do this for all the impulse locatio=
ns

HTH,

Jomar

Subject: Convoluting a train of impulses

From: Jose

Date: 26 Jan, 2009 18:24:01

Message: 5 of 5

Jomar Bueyes <jomarbueyes@hotmail.com> wrote in message <a67c5e35-3632-442e-86c9-4e79028bbe2f@g39g2000pri.googlegroups.com>...
> On Jan 26, 12:53=A0pm, "Jose " <jose.l.v...@gmail.com> wrote:
> > Jomar Bueyes <jomarbue...@hotmail.com> wrote in message <6531e450-ee83-45=
> 46-aea0-96e105303...@i20g2000prf.googlegroups.com>...
> > > On Jan 26, 12:34=3DA0pm, "Jose " <jose.l.v...@gmail.com> wrote:
> > > > Someone can help me how can I convolve a train of impulses generated =
> by a=3D
> > > =A0gamma function =3DA0with a gaussian kernel?
> > > > Cheers,
> > > > Jose.
> >
> > > Hi Jose,
> >
> > > The convolution of a train of impulses with a Gaussian kernel is the
> > > sum of a sequence of Gaussian kernels each with it center shifted to
> > > the location of a pulse in the train. With enough zero-padding on the
> > > Gaussian kernel you could use the Matlab circshift function to
> > > position the kernel before adding it to an accumulator. =A0However, if
> > > the sequence of pulses is long, you might be better off using FFTs to
> > > do the convolution.
> >
> > > HTH,
> >
> > > Jomar
> >
> > Hi Jomar,
> > Please could you write down a little code with it using the circshift fun=
> ction
> > (i am not interested in fft) after the spike train z i have written down =
> below:
> > Thanks in advance,
> >
> > %Here you are the gamma process:
> >
> > isi=3Dround(gamrnd(4,100/4,1,1000)); %this generates a gamma ISI of mean
> > %isi 100ms and order 4;
> > spk=3Dcumsum(isi);
> > spk=3Dspk(spk<1000);
> > z=3Dzeros(1,1000);
> > z(spk)=3D1;
> > Jose.
>
> Hi Jos=E9
>
> Assume that gk() is your Gaussian kernel with the maximum at gk(1) and
> with the negative part wrapped to the upper end of the array (that is
> Gaussian(-1) is stored in gk(end), Gaussian(-2) stored in gk
> (end-1), ..., Gaussian(-k) stored in gk(end-k+1)) and that there is
> enough zero padding in the middle of the gk array. Also assume that sl
> () is an array with the locations of the impulses
>
> > acc =3D zeros(size(gk)); % or other appropriate size for your problem
>
> then for each impulse location sl(k) you add a shifted Gaussian to the
> accumulator
>
> > acc =3D acc + circshift(gk, sl(k)); % do this for all the impulse locatio=
> ns
>
> HTH,
>
> Jomar

Thanks Jomar.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us