I currently have a .wav signal that was recorded at a 48 kHz sample rate, with a central frequency of 5.260 MHz and bandwidth of 4 kHz. I'm trying to get some information from this signal, specifically the location of the frequency peaks using matlab, which I would expect to be around 5.260 MHz. The code I'm using to generate the power spectral density is as follows:
path = '5.260MHz.wav'; f0 = 5.260e6; % frequency 5.260 MHz % sample properties [x, Fs] = wavread(path); % Fs = 48 kHz alias = 48e3*floor(f0/48e3); % starting frequency of target alias %estimate spectrum [psd, f] = pwelch(x, 512, , , Fs); % If the frequency lies in one of the mirror frequency bands, % we have to rotate about half the sample rate. if (mod(f0, 48e3) > 24e3) f = Fs - f; end plot(f + alias, psd)
This script produces the following plot
The bandwidth does seem to be 4 kHz as expected, but the frequency peaks appear to be in the wrong place. I would expect them to occur between 5.256 and 5.264 MHz, or maybe 5.258 and 5.262 MHz, not between 5.276 and 5.280 MHz.
However, when I generated my own files with the same central frequency and bandwidth, I got the following when I ran the above script:
% signal properties f0 = 5.260e6; % frequency 5.260 MHz sf = 4e3; % bandwidth 4 kHz % sample properties fs = 24e6; % sampling frequency 24 MHz N = 10e6; % number of samples % generate random frequency modulated sinusoidal signal fi = smooth(randn(N, 1), 11); fi = fi / std(fi) * sf + f0; x = cos(2 * pi * cumsum(fi) / fs); % downsample to 48 kHz (factor 500) x = x(1 :500: end); fs = fs / 500; wavwrite(x, fs, 'test_5.260MHz.wav');
This plot is exactly as expected, using the same script as the first plot. I'm wondering if I should be treating the first input different in some way to have it graphed correctly.
So far I've tried testing some other generated cosine signals using the same code as above, and they all graph correctly. However, every data signal I've tried has been off to some degree (I can post different sample plots if that would be useful). It could be an error with the data collection instrument, but it's far more likely to be a bug in my code.