# How to measure power spectral density in matlab?

I am trying to measure the PSD of a stochastic process in matlab, but I am not sure how to do it. If this is not the right place to ask, please point me in the right direction.

The stochastic process describes wind speed, and is represented by a vector of real numbers. Each entry corresponds to the wind speed in a point in space, measured in m/s. The points are 0.0005 m apart. How do I measure and plot the PSD? Let's call the vector V. My first idea was to use

[p, w] = pwelch(V);
loglog(w,p);


But is this correct? The thing is, that I'm given an analytical expression, which the PSD should (in theory) match. By plotting it with these two lines of code, it looks all wrong. Specifically it looks as though it could need a translation and a scaling. Other than that, the shapes of the two are similar.

-
This is an okay place to ask, but since there is no tag other than (matlab), the question has a good chance of being overlooked. I think Signal Processing is a better fit. You can request your post to be moved there by flagging it for moderator's attention. – user90090 Aug 15 '13 at 23:55
plot( abs( fftshift( fft( V ) ) ).^2 ); – AnonSubmitter85 Aug 16 '13 at 9:41
Thanks, both of you. I have added the Signal Processing-tag. If I use the above code, what should then be the unit of the x-axis? Note that this question is actually an exact duplicate of this question, which I have posted to get the most peoples attention. If you have any comments, here or there, please let me now. – torbonde Aug 16 '13 at 12:35
@cimrg.joe The units will be the reciprocal of whatever the units on V are. For instance, if the input is in seconds, then it's FT will be in 1/s (aka Hertz). If it's in meters, then it will be 1/m. – AnonSubmitter85 Aug 16 '13 at 20:29