AnsweredAssumed Answered

N5230A S11/S12 Parameter Data transfer using Matlab and GPIB

Question asked by Renae on Sep 11, 2007
Latest reply on Sep 11, 2007 by Renae
Hi all,

I've been trying to get this done for a few days now, this forum has been very helpful. 

I'm trying to measure S11 and S12 (So far only am on S11) parameters and transfer them to the PC.

I am using Matlab 7.4.0 and GPIB.

Thanks to a few people on here, I think I am getting the S-Parameter data back correctly.  But I would also like to get the X values to be able to graph it against the frequency.

I have tried using the SENSe:X? SCPI command, but I'm not receiving anything back, then I'll receive what looks like the X values back when I run the program again as the Y values when I get FDATA?

Obviously, I'm quite new at this, any help is appreciated.

na_gpib_address = 16;
net_ana = gpib('ni',0,na_gpib_address);
set(net_ana,'EOSMode','read&write')
set(net_ana,'EOSCharCode','LF')
set(net_ana, 'InputBufferSize', 5000000);
set(net_ana, 'Timeout', 30);
fopen(net_ana);

%Set to default setting
fprintf(net_ana,'SYST:PRES;*wai');

%Set up S11 Parameter Measurement
fprintf(net_ana,'DISP:WIND1 ON')
fprintf(net_ana,'CALC1:PAR:DEF "S11test",S11')
fprintf(net_ana,'SENS:FREQ:STAR 700000000')
fprintf(net_ana,'SENS:FREQ:STOP 1300000000')
fprintf(net_ana,'SENS:SWE:POIN MAX')
fprintf(net_ana,'DISP:WIND1:TRAC1:FEED "S11test"')

fprintf(net_ana,'INIT:CONT ON')

%Get Data
fprintf(net_ana, 'FORM REAL,32');                 
fprintf(net_ana, 'FORM:BORD SWAP');               
fprintf(net_ana, 'CALC:DATA? FDATA');             
header = fscanf(net_ana, '%c', 1);

numDigits = fscanf(net_ana, '%f', 1);            
byteCount = fscanf(net_ana, '%f', numDigits);
magnitude = fread(net_ana, byteCount/4, 'float32');

fprintf(net_ana, 'SENS:X?')
val=fscanf(net_ana)



Thanks for any help anyone might be able to give me.  I really appreciate it.  

Outcomes