I'm trying to calculate the SNR of a sine wave produced with a 12 bit DAC. I'm new when it comes to calculating/measuring noise in signals. My idea was to capture the signal using an oscilloscope (which unfortunately does not have an FFT function), so I could run an FFT analysis in MATLAB to separate the signal in its fundamental and harmonics to find the SNR.
This is the signal that I acquired, it's a 600 mVpp sine wave at 1kHz
I have 625000 samples, and according to the metadata from the oscilloscope, it has a sample interval of 1.6e-8s. My first approach was to use MATLAB's snr
function directly using the voltage samples
Fs = 625000;
r = snr(measurements, Fs);
Using that code I obtain this:
I was expecting the fundamental to be close to 1kHz, but it's sitting at 0.011 kHz with -9.699 dB. Is this result expected?
I also tried plotting the FFT using the following code (which again gives me this peak close to 0):
y = fft(measurements);
n = length(measurements);
fshift = (-n/2:n/2-1)*(625000/n);
yshift = fftshift(y);
plot(fshift,abs(yshift))