Setting time intervals in a cell array all to the same 0 to 5 second time interval
Show older comments
I am trying to find the spiking rates over 5 second intervals of time. I have the spike times of intervals in a cell array(spk). I am wondering if it is possible or if any of you clever coders might know of a way to set all of the intervals and spike times contained within those intervals to 0 to 5 second interval. For example, the spike time of the first interval in the cell is 59.031, so put that as 0.031. The next 59.0599 to 0.0599. Is this possible?
3 Comments
John BG
on 13 Jun 2016
I need some background.
Firstly please clarify the following points:
1.- when you say the 'rates' of those spikes, to me, I read you are after the frequencies, is my assumption correct?
If so you may try the FFT, I already have, but bare without options, not of much help, at least not over the interval of 5 seconds.
s1=spk{1}
s2=spk{2}
s3=spk{3}
S1=fft(s1);S2=fft(s2);S3=fft(s3);
stem(abs(S1)) % just one significant sample

2.- I have the impression that if you reveal a bit of the application, the readers of your question may be able to aim the answers on the right direction.
3.- Frequency analysis requires repetition, let me explain: When a certain event happens every time within the time window of observation (what you mention 5 seconds) such event has a frequency f1=1 cycle = 1 Hz = once per observation window. If another event happens twice as often within same time windowing, this second event has f2=2*f1.
Having it clear, your recording is a one-off, there is no repetition.
4.- Are all spikes the same, or can you tag them, with amplitude, phase, frame position?
5.= The '59.031 .. as 0.031' and '59.0599 to 0.0599', this rounding, you probably mean inversion f1=1/T1, right? to go from time domain to frequency domain?
6.- checking the 1st derivative is always useful:
Because the variations you want to study rates of are comparatively really small
ds1=diff(s1)
max(ds1)
=
1.581700000000005
min(ds1)
=
6.750000000010914e-04
mean(ds1)
=
0.058685843373494

so the widest variations away from a regular constant cycle interval occur between spikes 13 to 25 (within the 84 registered spikes of s1)
I don't think this comment qualifies as answer, but in the interest of answering something to be accepted, please shed some light, enough to develop an answer.
Regards
John BG
Krispy Scripts
on 13 Jun 2016
Krispy Scripts
on 16 Jun 2016
Answers (1)
Andrew Bliss
on 13 Jun 2016
Not quite sure what you're trying to do, but wouldn't mod help? E.g.
mod(59.031,1)
Categories
Find more on Electrophysiology in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!