Forums › SM Series Discussions › Calibration/Correction in MATLAB I/Q Data › Reply To: Calibration/Correction in MATLAB I/Q Data
Andrew
- This reply was modified 4 years, 7 months ago by
Andrew.
Consider doing your own FFT and windowing with something like the flattop window. The pwelch function uses the Hamming window which has ~1.8dB of scalloping loss and could easily account for most of the error you are seeing. The flattop windows has ~.1 dB of scalloping loss, and is much more appropriate for amplitude accuracy, and is likely what Spike is using in your measurements.
Here’s some example code for generating your own spectrum
function [spectrum] = calculatespectrum(t)
%CALCULATESPECTRUM
% Return the log spectrum of the input time domain signal
% The input is a real or complex column vector of floating point values
window = flattopwin(length(t));
if(~isreal(t))
window = complex(window);
end
% Normalize window
scalar = length(window) / sum(window);
window = window.*scalar;
spectrum = fftshift(fft(t.*window)./length(t));
spectrum = 10 * log10(abs(spectrum).^2);
end
If you want to compare with Spike, ensure you use the same reference level.
