AnsweredAssumed Answered

Fast capturing of trace data with Matlab

Question asked by Lennart on Feb 25, 2014
Latest reply on Feb 25, 2014 by vcherian
Hi,
I’m trying to capture trace data from a N9020A MXA spectrum analyzer using Matlab. With a FFT sweep, 10 MHz FFT width, 10 MHz span and appropriate RBW for the application I get a sweep time of 2 ms. Using Matlab on a decent workstation and a LAN connection, I’m able to capture a trace every 20 ms, pretty much regardless of the number of sweep points used. GPIB is faster for a limited number of trace points but slows down with increased number of sweep points.

Does anyone have any idea for improvement of the time to capture a trace? See Matlab code used below (based on Agilent example program). The code is based on direct I/O, which I understand is the fastest method.

The intention is to gather as much data as possible in both time and frequency domain and in a way that is as close to continuous in time as possible.


%mxa=visa(‘agilent’, ‘GPIB0::18::INSTR’);
mxa=tcpip(mxa_ip, 5025);
set(mxa,'InputBufferSize',100000);
set(mxa,'Timeout',5);
fopen(mxa);

fprintf(mxa,':FORM:DATA REAL,32');

fprintf(mxa,':INIT:CONT ON');
data=zeros(100,numberOfSweepPoints)
for i=1:100
    fprintf(mxa,':TRAC? TRACE1');
    data = binblockread(mxa,'float32');
    fscanf(mxa); %removes the terminator character
    data(i,:)=data;     
end
…  

Outcomes