How to compute fft for rat's licking time? 
I have data which measures the time when a rat licks a sugar water. When I compute the inter-lick interval (ILI), sometimes I see that ILI is less than 40 milliseconds which I don't think a rat can lick this fast, and I am assuming this is coming from a noise from the sensor. I want use fft in MatLab to compute the frequency of my licking signal. What all I have is the time when the rat has licked sugar water. Can somebody please tell me how I can compute the frequency of my signal.
Here is my code: and the results are shown too
if X is the licking time is this code to compute the fft?
dbin_lick=10;
binrange=0:dbin_lick:X(end);
bin_count=histc(X,binrange);
subplot(2,2,1)
bar(binrange,bin_count,'histc')
xlabel('Lick Time (ms)')
ylabel('Licks#')
Fs = 1000/dbin_lick;  % Sampling frequency
T = X(end);             % Sampling period
L = length(X);             % Length of signal
t = (0:L-1)*T; 
n = 2^nextpow2(L);
Y = fft(X,n);
[![enter image description here][1]][1]P2 = abs(Y/n);
P1 = P2(1:n/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(n/2))/n;
subplot(2,2,2)
plot(f,P1)
title('Single-Sided Amplitude Spectrum of Lick Time')
xlabel('f (Hz)')
ylabel('|P1(f)|')
clearvars -except X
X2=diff(X);
dbin_lick=0.03;
binrange=0:dbin_lick:1;
bin_count=histc(X2,binrange);
subplot(2,2,3)
bar(binrange,bin_count,'histc')
xlabel('ILI (ms)')
ylabel('ILI #')
Fs = 1000/dbin_lick;  % Sampling frequency
T = X2(end);             % Sampling period
L = length(X2);             % Length of signal
t = (0:L-1)*T; 
n = 2^nextpow2(L);
Y = fft(X2);
P2 = abs(Y/n);
P1 = P2(1:n/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(n/2))/n;
subplot(2,2,4)
plot(f,P1)
title('Single-Sided Amplitude Spectrum of ILI')
xlabel('f (Hz)')
ylabel('|P1(f)|')`    


 A: If your data is event times (lick times), I would not look for 60 Hz electrical noise with an fft. (In fact, I don't know how you'd calculate an fft for event times like you have. There are probably ways to do it, but I don't know them.) 
Here's what I would do.
First, are you sure your data is what you think it is? Specifically, what the heck is going on with your lick time histogram? Are there really 50 licks occurring between 0 and 10 ms? That is either one very fast rat, or your units are wrong in the x-axis, or you're combining lick times across many trials. If you're combining lick times across trials, are you calculating ILIs on this combined data? If so you may be, for example, measuring the time difference between licks on different trials, which is not what you want to measure.
Assuming your data is good, and you want to assess whether there's 60 Hz electrical noise in your lick times, I'd focus on the ILIs themselves. 60 Hz noise has a period of 1 / 60 Hz = 16.6 ms. That means electrical noise will produce events spaced 16.6 ms apart, meaning a histogram of ILIs with strong electrical noise should have a peak at 16.6 ms. To illustrate, I simulated some data below.
I simulated your data assuming it contains some events due to electrical noise and some events due to real licks. There are 1,000 "licks" occurring randomly between 0 and 10 s. There are also ~500 events due to noise. To generate these, I made events spaced 16.6 ms apart, and I then removed 10% of them. Here's a histogram of the event times:

Next I computed the histogram of ILIs. I used a bin width of 1 / (60 Hz) / 10 - that is, 1/10th the expected period of the electrical noise. You can see that there's a clear peak in the 10th bin, i.e at 16.6 ms. That's the electrical noise. Voila.

Of course if electrical noise is only causing a few spurious events it will be harder to detect. Also if the noise isn't periodic you cannot use this method to detect it. In that case the only thing I can think of is remove ILIs below a defined cutoff. This is what I've done previously for similar reaction time data.
A: I agree with other answers/comments here that suggest that a Fourier transform is not very useful in this analysis.  Remember that Fourier analysis is used to measure periodic signal with a fixed period.  It is very poor at detecting signals in cases where the time of the oscillations varies.  For a rat licking sugar-water, it may very well be the case that he tries to lick the water with some regularity, leading to a kind of periodic signal for the lick-times.  However, even one badly timed lick will then throw out the periodic nature of the signal so that remaining licks no longer have the same phase-angle as previous licks, and this will not show up as a clear signal in the frequency domain.
Rather than doing a Fourier analysis, you would be much better off in this case modelling the individual lick times as something like a Markov chain.  Start by looking at the histogram of lick-times and then go deeper to analyse whether the lick-times are auto-correlated.  You have identified the possibility that some of the lowest lick-timmes may be measurement error (i.e., not genuine values), and so it would also be useful to look at the behaviour of the times at the lower end, so see if you can make an inference about which values are erroneous.
Looking at your histogram of lick-times, you can already see that there is massive variation, and so it is not likely to lead to distinct signals in the frequency domain (as confirmed by the plot in this domain).  There is also a tall count bar at very low lick times, which may be due the measurement error.  More interesting would be to make an auto-correlation plot showing whether lick-times are correlated with those that went before.
