# How to find PSD (Power spectral density) of spatial data

I have profiled a surface, measuring the height of peaks and troughs at 0.02mm intervals. I have 1501 data points, the below listed as an example:

\begin{align} x &= 0\,\mu\text m & y &= 20\,\mu\text m\\ x &= 20\,\mu\text m & y &= 15\,\mu\text m\\ x &= 40\,\mu\text m & y &= 12\,\mu\text m\\ x &= 60\,\mu\text m & y &= 10\,\mu\text m\\ \end{align}

How do I generate a spatial as opposed to frequency PSD plot using Matlab? i.e. what function should I use.

Thankyou

• Just think of your $x$ being called $t$. It doesn't matter for the underlying math what your units of physical significance of the data is. – Marcus Müller May 27 '16 at 12:20
• If you actually consider this, you couldn't call it Power Spectral Density, because Power is "Energy per Time", and you have neither Energy nor time as axes (you can argue potential energy is proportional to height square just as electrical signal energy is proportional to voltage square, though). I'd probably call this a "Potential spectral density"; you could even keep the PSD acronym :) – Marcus Müller May 27 '16 at 12:21
• Correction: "Potential" neglects the "Energy per length" aspect, so I'd probably call this a "Slope spectral density"; "Slope" is "height over length"; SPD is a nice name. – Marcus Müller May 27 '16 at 12:27
• I went ahead and made both columns of data have the same unit, μm. – Marcus Müller May 27 '16 at 12:30
• by the way, have you really only got these four points? – Marcus Müller May 27 '16 at 12:30

if norm(diff(X,2)) < sqrt(eps) % is X evenly spaced ?