I have some problems with the matlab code for using VNA to measure S parameter using USB-GPIB.

VNA = instrfind('Type', 'gpib', 'BoardIndex', 8, 'PrimaryAddress', 16, 'Tag', '');

if isempty(VNA)

VNA = gpib('agilent', 8, 16);

else fclose(VNA);

VNA = VNA(1);

end

frequency_start=2e9;

frequency_stop=3e9;

I am now doing a project involving measuring the s parameter.

I will appreciate anyone who can provide me a sample matlab code.

Hello Taitai,

I typed "MATLAB code PNA Keysight" into google and came across a MathWorks page that has a programming example of a two port S-parameter measurement using the Instrument Control toolbox. I would suggest taking a look at that and going from there.

Two Port S-Parameter Measurement - File Exchange - MATLAB Central