MATLAB FFT vs Oscilloscope FFT
Show older comments
Hello,
I have an issue with what the oscilloscope's FFT is showing and using the same time domain data and performing an fft in MATLAB.
I'm measuring a signal on a Keysight DSO-S oscilloscope. It's set to 20 MSaS and 30Mpts. There are two 1 MHz signals on channel 1 and 4. I'm performing an two FFTs on the scope on each channel and saving the data. The scope's mat file contains both time domain data for channel 1 and 4, and FFT function data on both.
Now when plotting the scope's FFT and doing a MATLAB FFT on the time domain data I get two different pictures. Why is that?
For MATLAB I'm using a standard code found in fft() help:
Fs = 1./Channel_1.XInc; % Sampling frequency (20e6 Samples per second)
f = Fs*(0:(L/2))/L; % Frequency vector
dataOut = TDS2; % Time domain data loaded previously
DS0 = fft(dataOut);
DS0 = abs(DS0./L);
DS = DS0(1:L/2+1);
DS(2:end-1) = 2.*DS(2:end-1);
DSF = 10.*log10(DS.^2/50e-3); % Voltage converted to dBm with a 50 ohm load
plot(f, DSF)
For the scopes functions I'm getting the following graphs:

For MATLAB plot I'm getting something different:

Does anyone know what I'm doing wrong in MATLAB and why I'm losing all the data around 1 MHz?
2 Comments
Lucy
on 17 Jan 2024
Hello, I encountered a similar problem recently and would like to know if you solved it? Thank you!
Mathieu NOE
on 17 Jan 2024
hello
we don't know what the scope does .
is the data splitted , windowed , averaged (method ? ) .... this must be known before you can expect the matlab code to produce a similar output
for example what is the frequency resolution in both situations ?
Answers (0)
Categories
Find more on Oscilloscopes in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!