What's the sampling frequency when synthetically generating data?

Say I am using matlab's random number generator to get an array of random numbers, which I will then, for testing purposes, find the spectral density etc. For that purpose I need to know the sampling freq., but these have been generated synthetically so I am not sure how the sampling theorem applies here.

You do not need to know the sampling frequency in order to determine the power spectral density (PSD). The frequency variable of the PSD of a sequence is normalized by the sampling frequency. You only need the sampling frequency if you want to denormalize that relative frequency and talk about absolute frequencies in Hertz. In this case, since no sampling was involved, you're free to choose any sampling rate that you like.

• You can use units of "normalized frequency". There is not one consistent definition, but there is a summary here:en.wikipedia.org/wiki/… – John Mar 26 '15 at 12:36
• If I am simply using randn in Matlab, then I want to use Welch method, that requires a sampling frequency. So you say I can choose any value? – student1 Mar 26 '15 at 13:50
• @student1: I don't think that you need to provide a sampling frequency for using Welch's method. Also see Robert's answer. – Matt L. Mar 26 '15 at 14:10

The sampling rate is arbitrary- you choose it.

Usually people are simulating a real situation, like, for example, audio from a CD. Then you would choose the sample rate to be 44.1 kHz.

@student1, it seems to me that there is an option of MATLAB's pwelch function that uses normalized frequency:

[pxx,w] = pwelch(x,window,noverlap,w)

i think that w means "$\omega$" and is normalized angular frequency (i.e. $\omega = \pi$ is Nyquist). if you use

[pxx,f] = pwelch(x,window,noverlap,f, fs)

then the specified frequencies are not angular frequencies and are relative the the sampling frequency fs. i have never used pwelch, but that is what it appears to be at the mathworks website.