1
$\begingroup$

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

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – Marcus Müller May 27 '16 at 12:20
  • $\begingroup$ 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 :) $\endgroup$ – Marcus Müller May 27 '16 at 12:21
  • $\begingroup$ 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. $\endgroup$ – Marcus Müller May 27 '16 at 12:27
  • $\begingroup$ I went ahead and made both columns of data have the same unit, μm. $\endgroup$ – Marcus Müller May 27 '16 at 12:30
  • 1
    $\begingroup$ by the way, have you really only got these four points? $\endgroup$ – Marcus Müller May 27 '16 at 12:30
0
$\begingroup$

A spectrum estimation method that works well in many cases is Welch's method. The MATLAB implementation is pretty straight forward to use, even when not knowing about the math behind it. Following Marcus' recommendations, you could try:

if norm(diff(X,2)) < sqrt(eps) % is X evenly spaced ?
    Fs = 1/mean(diff(X)); % find the step size of X
    [Pyy,F] = pwelch(Y,[],[],[],Fs,'onesided','PSD'); % compute the PSD
    plot(log10(F),log10(Pyy)), xlabel('log [\mum^{-1}]'), ylabel('log[PSD[\mum^2/\mum^{-1}]]')
    axis tight, grid on
end
$\endgroup$
  • $\begingroup$ Thanks for this, it appears to be giving me sensible looking results, certainly correlates with what I can physically see in the raw data. $\endgroup$ – Pop24 May 31 '16 at 16:25
  • $\begingroup$ Good :) there was a mistake in the code example, by the way, Fs should be the inverse of the step size... I've made an edit $\endgroup$ – Arnfinn May 31 '16 at 23:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.