File Exchange

image thumbnail

RF Utilities V1.2

version 1.2 (304 KB) by

Routines for Smith Chart, TDR, Mixed-Mode S-params, Matching



View License

Matlab RFutilities

Written and tested on MATLAB Version 5
Hopefully all will be well on subsequent versions...

These Matlab m-files were originally written to display measured
or calculated input impedances. The collection of routines
allows data to be plotted as Smith Chart, Admittance Chart,
Return Loss, VSWR and Mismatch Loss. Frequency markers can be
added to each of the plot types.

Over time the routines have been added to so that measured/calculated
impedance can be modified before display. A simple transmission line
model allows measured data to be de-embedded (using a –ve length).
Matching can be achieved using lumped L,C,R elements or transmission lines.

There are CITI file loaders for the HP standard data format and a
time domain reflectometry function (actually chirp-Z transform) to
display impedance as a function of distance.

The routines that deal with input impedance use the form Zin=A+jB Ohms,
rather than the reflection coefficient S11,S22 etc. This is simply because
I feel it is easier and more intuitive to work with input impedance in
this form.

An additional set of routines to display the transmission parameters :
Insertion Loss, Phase Delay and Group Delay use the usual S-parameter
form S21,S12 etc. Again because I feel it is easier to work with
transmission parameters in this form.

There are routines to convert between S11 and Zin there is a function
to convert standard S-param to mixed mode S-param, allowing differential
and common mode impedances to be displayed.

The latest addition to the routines allow the design and analysis of stepped
and tapered line impedance transformers. These include Chebyschev and Binomial
stepped transformers; Exponential , Triangular and Klopfenstein tapered line
transformers. There are also routines for realising the designs as Microstrip
layouts and exporting them from Matlab to AutoCad DXF format. Finally, there
is also a routine for designing broadband Wilkinson splitters.

All m-files have help-comments and there are numerous example scripts.
The files are split between 3 folders RFutils, RFutils_S and Rfutils_M.

Ideally these should be copied into the Matlab toolbox directory so the
search paths become : C:\Matlab\toolbox\RFutils, C:\Matlab\toolbox\RFutils_S
and C:\Matlab\toolbox\RFutils_M.

Once you have copied the files and added them to Matlab's search paths,
type :

help rfutils - lists all the functions in Rfutils and Rfutils_S
example1 - run example1 etc...through to 11

help rfutils_m - lists all the functions and examples in Rfutils_M

Thankyou for taking the time to give these utilities a whirl, enjoy!

N. Tucker

Comments and Ratings (13)

Lina Chang

Of all the Smith chart scripts that I've tried this one is my favorite, for one thing IT WORKS.

dx wang

a good tool


I looked at the loads2p some more and realized that it does not assume dB values but natural magnitudes. My previous comment still stands about including in the header what format the data should be in; however, the option line should be # Hz S MA R 50.


I would suggest changing line 37 of loads2p.m to if ( any(L~=(-1)) && ~strncmpi(L,'!',1) && ~strncmpi(L,'#',1) );

This accounts for more than just two header lines and takes care of the option line.

I also noticed that the file assumes that the data is in dB magnitude format. Perhaps there should be something in the header of loads2p similar to % Data must be save in # Hz S DB R 50 format.

This may not be the best way to phrase it, but its an idea.

A revision down the road might analyze the option line (line start with #) and adjust accordingly.

Thank you for writing these routines. It has saved me countless hours over the past five years.


Savas (view profile)

good smith charts


Dear All,

If i have spice model of LDMOS FET how can i simulate in matlab ?

I need simulation metod for RF push-pull amplifiers


Basically i observed in Matlab rftool which is easy to simulate for single ended amplifiers when s2p files are provided. If i have Zin and Zout data for RF push-pull amplifier how can i simulate and Where i can generate Unbalanced to balanced transformers in coaxial line structures ?

Ex: I have a data of UF2820P of MACOM download data from internet and give me guidelines how can i simulate it? Please send your answers to

Neill Tucker

Neill Tucker (view profile)

Dear all,

Thank you for your kind comments.

Thank you to Matt for the file access suggestion, good idea, I will make the necessary changes.


Matt C

Matt C (view profile)

Thanks for putting this all together. The code is easy to
read and modify for targeting specific tasks. Great work!

Matt C

Matt C (view profile)

Change request:

Since I update my MATLAB frequently, I have started placing my MATLAB code in a directory outside of the programs install path so I don't have to worry about losing it between releases. Anyway, I was running through your examples and found that in example8, the data file is hard coded to a path. I recommend that this is changed with the below code.

Old line (23) :

New code block:
filename = which('example8');
pathstr = fileparts(filename);
citifile = 'data04.d2';
[S11,S21,S12,S22,Freq]=citi2s(strcat(pathstr, filesep, citifile));

This will get the path of example8 and set the citifile path to the same directory as the example. This should alleviate installation specific runtime errors.

Larry Kushner

I was not in love with the programs defaulting to figure(2), so I commented out those lines, and used 'gcf' in place of '2' in some of the funtion calls.

Larry Kushner

Beautiful smith impedance & admittance charts. Intuitive interface. Lots & lots of useful routines. In less than 10 minutes I was generating useful plots and getting back to solving my problems.


Great CITI file import! Thanks for writing it.



Slight re-organization of examples, addition of routines to design stepped and tapered line matches and output in dxf format.


Example data file access now independent of installation, as requested.
Two-stub match example added.
See changelog.txt for details.

MATLAB Release
MATLAB 5.2 (R10)

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

» Watch video