I'm trying to analyze the power spectral density of a signal recorded from a Ham radio antenna. The signal is about 30 seconds long, recorded at a 48 kHz sample rate. The frequency is center frequency of 8 kHz recording, with the receiver centered on 5.275 MHz. The signal I'm currently looking at is supposed to be around 5.260 MHz, however I'm getting inconsistent results with the matlab script below:
[FileName,PathName] = uigetfile('*.wav','Select the wav file'); PathName = strcat(PathName, FileName); %Adds the filename to the end of the pathnames [x,Fs] = audioread(PathName); [pxx,f] = pwelch(x,500,300,500,Fs); plot(f,pxx) xlabel('Hz'); ylabel('dB');
When I run this code with '5.260MHz.wav', it produces the following plot:
These frequency peaks all occur between 0-4 kHz, which is unexpected. Since 5.260e6 mod 48e3 = 28e3, I would expect the signal to be at 48e3 - 28e3 = 20e3, or 20 kHz.
I created my own signal and then undersampled it as follows:
% signal properties f0 = 5.260e6; % frequency 5.260 MHz sf = 8e3; % bandwidth 8 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); Fs = Fs / 500; x = x(1 :500: end); filename = 'test_5.260MHz.wav'; audiowrite(filename,x,Fs);
When I plot this signal with the above script, it looks as expected, with a peak at 20 KHz:
Finally, I used the following script from the mathworks site to create another signal, which also graphed as expected:
Fs = 1000; % Sampling frequency T = 1/Fs; % Sample time L = 1000; % Length of signal t = (0:L-1)*T; % Time vector % Sum of a 50 Hz sinusoid and a 120 Hz sinusoid x = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t); y = x + 2*randn(size(t)); % Sinusoids plus noise filename = 'test_50_120Hz.wav'; audiowrite(filename,y,Fs);
Because I'm getting consistent results with my generated files, I would like to believe that there is simply an error with the information concerning my antenna signal. However, I have several different antenna signals, and they are all graphing in the 0-4 kHz range, regardless of where the signal supposedly exists or the central frequency. This leads me to believe that I may be using the matlab code incorrectly, or that I may be misinterpreting how .wav files and radio signals work exactly.
Any input is appreciated. As I am still new to stackexchange, any suggestions on how to make the question clearer are also appreciated.