# Plotting tool

The Circuit Mason suite comes with a simple plotting tool. The plotting tool is launched from TinyCad using the "P" button. It can also be run as a stand-alone product.

From the File Menu, you can "Open File" for an existing S-Parameter file (.s*p). Alternatively, you can "Save Equations" or "Load Equations"- this uses a file (*.plt) which stores the file name of the file data is being pulled from, the equations that were plotted, the ype of plot, and the X and Y limits. No data is actually stored in the plot file, data is pulled fresh from the original file.

Some additional thoughts can on plotting are at the bottom of Advanced S-Parameters.

### Equations

The plotting tool allows for either Smith chart or rectangular plots of up to six color-coded equations in the muParser format, where the S-Parameters are S_1_1, S_2_1, etc. The equations are parsed using the muParser engine, so more complicated functions are possible. For example, insertion loss can be plotted with: -10*log10(abs(S_2_1)^2/(1-abs(S_1_1^2))), shown in Figure 1. Additionally, group delay can be plotted by appending "gd" to the S-Parameter, such that "S_2_1gd * 1e9" will plot the group delay in nanoseconds.

Figure 1: Log plot showing two equations (click to enlarge)

### Smith Cart Port Impedance

Mason outputs S-Parameters, and the Smith Chart by default assumes that these S-Parameters are 50-ohms. However, this is not necessarily true: it may be advantageous to use both a 50-ohm and 100-ohm port when designing a quarter-wave transmission line. The S-Parameters for a well-matched system are in the center of the Smith Chart, no matter the impedance, and Mason Plot does not intrinsically know how to normalize the impedance.

One can optionally type the impedance, followed by a colon, and then the equation:

S_1_1 [this will default to "well matched" as 50-ohms]

100: S_2_2 [this will plot "well-matched" at 100-ohms, not 50]

100: (S_2_2-S_1_2) [this will plot "well-matched" at 100-ohms, not 50]

### Legend Control

By default, the legend is the equation as written in the Equation List.

One can optionally type text in quotes after the equation:

100: 0.5*(S_1_1 +S_2_2 - S_1_2 - S_2_1) "Differential Input Impedance"

S_1_2 "Isolation"

### Buttons

Several controls are available in the window. Press the "Refresh" button to update the plot when changes are made to the equations or the limits. You can also copy the plot (including the color coordinated equations) using the "Copy" button. While the frequency or Y-Axis limits can be manually changed, the Y-Limits can be automatically generated using the "Autoget Y-Limits" buttons. The X-Axis units will be the same as the original Touchstone file.

### Types of Plots

Three plot types are available: Smith, Log, and Arg. A Smith chart plot is show in Figure 2 below. The "Log" and "Arg" buttons both use a rectangular grid, but the "Arg" plot will unwrap phase in degrees. Again, the equations are calculated using the muParser engine.

Figure 2: Smith chart plot of two parameters (click to enlarge)

Mason outputs Touchstone files, and Mason Plot can be used as a general purpose Touchstone viewer. The simplest way to take advantage of this is to drag a Touchstone file onto the "simple_plot_dialog.exe" icon, and "Open with" the program.

### Statistical Plots

If a Monte Carlo run is performed in Mason, and if the stat_output="true" flag is set, then two Touchstone files are generated by Mason. The first will be named "*.out" and the second will be named "*.out.stat". If Mason Plot opens a "*.out" file and the "*.out.stat" file exists, then the statistical plotting features are enabled. This is done automatically.

Two options (plus a text control box) define the statistical plot. If the "Use Stats" box is checked, then a modified Box Plot is drawn (Figure 3). The text box "Box Plot % Included" controls the percentile limits: 50 equates to 50% of the population is within the upper and lower percentile limits, which is between the 25th percentile and the 75th percentile, a standard Box Plot. A value of 90 will plot the 5th percentile to the 95th percentile. The minimum and maximum are also plotted, but unlike a Box Plot this is really the minimum and maximum (outliers are included). The "Box Plot % Included" can range from 0 (which is the median) to 100 (which is the minimum and maximum).

Figure 3: Modified Box Plot

The second option, "Plot all", plots all of the data (Figure 4). This option ignores "Box Plot % Included".

Figure 4: Statistical output showing all runs that fall from the 25th and 75th percentile

*Copyright 2010, Gregory Kiesel*