View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Two Port S-Parameter Measurement

3.3 | 3 ratings Rate this file 15 Downloads (last 30 days) File Size: 20.6 KB File ID: #24219 Version:

Two Port S-Parameter Measurement



20 May 2009 (Updated )

Perform a 2-port s-parameter measurement using the Instrument Control Toolbox.

| Watch this File

File Information

MATLAB is a software environment and programming language with over 1,000,000 users and is used to generate arbitrary and standard waveforms, configure and control instruments, build automated test applications, and analyze and visualize data from other instruments. MATLAB only supports instrument communication when you use MATLAB with its Instrument Control Toolbox.
This example uses MATLAB to configure an Agilent PNA network analyzer and perform a 2-port S-parameter measurement using the Instrument Control Toolbox.
To execute this example, type ‘[frequencies sParameters] = acquireTwoPortSParameters’ in the MATLAB command window. [Note: Change the VISA resource string in the acquireTwoPortSParameters.m file to the VISA resource string corresponding to your instrument]. The MATLAB function: acquireTwoPortSParameters, returns two output arguments i.e. the 2-port s-parameter measurement together with the frequencies at which the measurements are made. This MATLAB function uses SCPI commands over a VISA interface object to interact with the instrument.
The other files contained in this submission are:


The MAT-File cableData.mat contains sample frequency data and a 2-port s-parameter measurement from a successful run of "acquireTwoPortSParameters". This file is independent of "acquireTwoPortSParameters" and is meant to provide an example of the data typically returned from such a measurement, without actually running the program.

The Simulink Model TxLineModel.mdl is a baseband equivalent model of a simple transmission line. This model may be configured with the data obtained using "acquireTwoPortSParameters". This model is also meant for illustrative purposes only and is not an essential part of the M-File.
To learn more about using MATLAB and Instrument Control Toolbox for configuring and controlling instruments, visit:
To request a trial of MATLAB and/or Instrument Control Toolbox, visit
For additional information on using MATLAB with Agilent instruments, including MATLAB examples, demos, drivers, and videos, visit:

Required Products Instrument Control Toolbox
MATLAB release MATLAB 7.6 (R2008a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (6)
15 Jun 2016 Vinod

Vinod (view profile)

You will find an example of making S-parameter measurements from a PNA here:

Comment only
15 Jun 2016 abadlia bagdad

The program doesn't work ??

Comment only
09 Apr 2014 Yongjun

There has something wrong with the code on my computer. The Function: localConfigurePNA, localFetchdata are not found in my matlab. How can I correct it?
Thank you!

Comment only
23 Jan 2013 Rica

Rica (view profile)


it is really good program. How could i manipulate it to get S parameters each second. I am making measurement with Network analyzer. the characteresic of the device under Test is changig with Time.

Thank you

23 Sep 2010 Raj Sodhi

Raj Sodhi (view profile)

The post is appreciated, but the code doesn't work. There is a function that uses a variable 'visaObj', but this isn't passed. Needs more debugging.



function localConfigurePNA(fileFormat)
%% Preset system
% OPC? = All Operations Complete? +1 for Yes

27 May 2009 Siddharth Shankar

26 May 2009 1.1

Updated description of submission.

01 Sep 2016

Updated license

Contact us