## How to plot the power spectrum and the cross spectrum for spike trains?

### litt.cuss (view profile)

on 9 Jul 2019
Latest activity Answered by Kaashyap Pappu

### Kaashyap Pappu (view profile)

on 16 Jul 2019
Hello everyone, I would need some hints regarding the spectral analysis for spike trains. I am new in this field, and I don't really know how to deal with it. I read some notes about spectral analysis and spike trains, but I still cannot manage to obtain what I would like to obtain.
Here is my issue: we have two spike trains which are modeled by inhomogeneous Poisson process and which I represent as the sum of Dirac delta functions.
What I would like to get is the power spectrum of the two, and the cross-spectrum between them.
I tried both by using pwelch function and by using xcorr() and fft functions, but I do not get (even close to) what I would expect.
Am I wrong in using such representation of spike trains of Dirac delta?
Any suggestions will be more than appreciated. Thank you

### Kaashyap Pappu (view profile)

on 16 Jul 2019

Hi,
As I understand, you have tried to perform spectrum analysis on impulse trains generated using the functions “pwelch”, “fft” and “xcorr” functions.
You could try to use the “dsp.SpectrumAnalyzer” object to carry out spectral analysis. The steps and parameters required to use this object are provided https://in.mathworks.com/help/dsp/ref/dsp.spectrumanalyzer-system-object.html. Use 3 ports for the 3 signals.
Furthermore, the function “pwelch” is used to obtain a one-sided frequency spectrum. If the Sampling Rate is not specified, the function makes the appropriate adjustments for analysis. Make sure the sampling rate is defined correctly based on the impulse train duration. Refer to https://in.mathworks.com/help/signal/ref/pwelch.html?s_tid=doc_tafor more information.
The “fft” function provides a 2-sided spectrum. This is elaborated in the following link https://in.mathworks.com/help/matlab/ref/fft.html?s_tid=doc_ta.