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.
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.