I am trying to find the power spectral density of a signal measured at uneven times. The data looks something like this:

0 1.55 755 1.58 2412256 2.42 2413137 0.32 2497761 1.19 ...

where the first column is the time since the first measurement (in seconds) and the second column is the value of the measurement.

Currently, using the periodogram function in Matlab, I have been able to estimate the power spectral density by using:

nfft = length(data(:,2)); pxx = periodogram(data(:,2),[],nfft);

Now at the moment, to plot this I have been using

len = length(pxx); num = 1:1:len; plot(num,pxx)

Which clearly does not place the correct x-axis on the power spectral density (and yields something like the plot below), which needs to be in frequency space. I am confused about how to go about this given the uneven sampling of the data.

What is the correct way to convert to (and then plot in) frequency space when estimating the power spectral density for data that has been unevenly sampled? I am also interested in tackling this from a python/numpy/scipy perspective but have so far only looked at the Matlab function.