AnsweredAssumed Answered

Measure and transfer S parameter (N5230A)

Question asked by jib on Jun 16, 2011
Hi Agilent users! I am in need of help to create a somewhat simple program for a project that I have been working on for the past three weeks. My main goal is to communicate with a N5230A network analyzer using matlab and read back S parameter data from it onto matlab and hopefully create an excel file with the data and plot it. As of now, I can communicate with the analyzer and make one S parameter measurement and save the data into a .s2p file onto the machine. My goal is to instead have this data in matlab and hopefully make an excel file from the data and also to be able to measure more than one S parameter. This is my code below. For simplicity, I have edited out the comments but if anyone wants me to put them back I can do so easily.  Any help is gladly appreciated.


pna = gpib('ni', 0, 16);


fopen(pna);


fprintf(pna,'*IDN?');


idn = fscanf(pna);

idn

fprintf(pna,'SYST:FPRESET');


fprintf(pna,'DISPlay:WINDow1:STATE ON');

fprintf(pna,'CALCulate:PARameter:DEFine:EXT "MyMeas",S21');

fprintf(pna,'DISPlay:WINDow1:TRACe1:FEED "MyMeas"');

fprintf(pna, 'INITiate1:CONTinuous OFF;*OPC?');
opc = fscanf(pna);
fprintf(pna, 'SENSe1:SWEep:TRIGger:POINt OFF');

fprintf(pna, 'SENSe1:SWEep:POINts 9');

fprintf(pna,'SENS:FREQ:START 1000000000');

fprintf(pna, 'SENS:FREQ:STOP 2000000000');

fprintf(pna, 'INITiate1;*OPC?');
opc = fscanf(pna);

fprintf(pna, 'CALCulate1:PARameter:SELect "MyMeas"');

fprintf(pna, 'FORMat ASCII');


fprintf(pna, 'CALC1:DATA:SNP:PORTs? "1,2"')

result = fscanf(pna)

fprintf(pna, 'CALC1:DATA:SNP:PORTs:SAVE "1,2", "C:/Documents and Settings/Administrator/Desktop/mydata.s2p"');



fclose(pna);  

Outcomes