Analyze and Plot RF Components

Analyze Networks in the Frequency Domain

RF Toolbox™ software lets you analyze RF components and networks in the frequency domain. You use the analyze method to analyze a circuit object over a specified set of frequencies.

For example, to analyze a coaxial transmission line from 1 GHz to 2.9 GHz in increments of 10 MHz:

ckt = rfckt.coaxial;
f = [1.0e9:1e7:2.9e9];
analyze(ckt,f);

Note

For all circuits objects except those that contain data from a file, you must perform a frequency-domain analysis with the analyze method before visualizing component and network data. For circuits that contain data from a file, the toolbox performs a frequency-domain analysis when you use the read method to import the data.

When you analyze a circuit object, the toolbox computes the circuit network parameters, noise figure values, and output third-order intercept point (OIP3) values at the specified frequencies and stores the result of the analysis in the object's AnalyzedResult property.

For more information, see the analyze reference page or the circuit object reference page.

Visualize Component and Network Data

The toolbox lets you validate the behavior of circuit objects that represent RF components and networks by plotting the following data:

  • Large- and small-signal S-parameters

  • Noise figure

  • Output third-order intercept point

  • Power data

  • Phase noise

  • Voltage standing-wave ratio

  • Power gain

  • Group delay

  • Reflection coefficients

  • Stability data

  • Transfer function

The following table summarizes the available plots and charts, along with the methods you can use to create each one and a description of its contents.

Plot Type

Methods

Plot Contents

Rectangular Plot

plot

plotyy

loglog

semilogx

semilogy

Parameters as a function of frequency or, where applicable, operating condition. The available parameters include:

  • S-parameters

  • Noise figure

  • Voltage standing-wave ratio (VSWR)

  • OIP3

Budget Plot (3-D)

plot

Parameters as a function of frequency for each component in a cascade, where the curve for a given component represents the cumulative contribution of each RF component up to and including the parameter value of that component.

Mixer Spur Plot

plot

Mixer spur power as a function of frequency for an rfckt.mixer object or an rfckt.cascade object that contains a mixer.

Polar Plot

polar

Magnitude and phase of S-parameters as a function of frequency.

Smith® Chart

smithplot

Real and imaginary parts of S-parameters as a function of frequency, used for analyzing the reflections caused by impedance mismatch.

For each plot you create, you choose a parameter to plot and, optionally, a format in which to plot that parameter. The plot format defines how the toolbox displays the data on the plot. The available formats vary with the data you select to plot. The data you can plot depends on the type of plot you create.

Note

You can use the listparam method to list the parameters of a specified circuit object that are available for plotting. You can use the listformat method to list the available formats for a specified circuit object parameter.

The following topics describe the available plots:

Rectangular

You can plot any parameters that are relevant to your object on a rectangular plot. You can plot parameters as a function of frequency for any object. When you import object data from a .p2d or .s2d file, you can also plot parameters as a function of any operating condition from the file that has numeric values, such as bias. In addition, when you import object data from a .p2d file, you can plot large-signal S-parameters as a function of input power or as a function of frequency. These parameters are denoted LS11, LS12, LS21, and LS22.

The following table summarizes the methods that are available in the toolbox for creating rectangular plots and describes the uses of each one. For more information on a particular type of plot, follow the link in the table to the documentation for that method.

MethodDescription
plotPlot of one or more object parameters
plotyyPlot of one or more object parameters with y-axes on both the left and right sides
semilogxPlot of one or more object parameters using a log scale for the X-axis
semilogyPlot of one or more object parameters using a log scale for the Y-axis
loglogPlot of one or more object parameters using a log-log scale

Budget

You use the link budget plot to understand the individual contribution of each component to a plotted parameter value in a cascaded network with multiple components.

The budget plot is a three-dimensional plot that shows one or more curves of parameter values as a function of frequency, ordered by the circuit index of the cascaded network.

Consider the following cascaded network:

casc = rfckt.cascade('Ckts',...
       {rfckt.amplifier,rfckt.lcbandpasspi,rfckt.txline})
The following figure shows how the circuit index is assigned to each component in the cascade, based on its sequential position in the network.

You create a budget plot for this cascade using the plot method with the second argument set to 'budget', as shown in the following command:

plot(casc,'budget','s21')

A curve on the link budget plot for each circuit index represents the contributions to the parameter value of the RF components up to that index. The following figure shows the budget plot.

Budget Plot

If you specify two or more parameters, the toolbox puts the parameters in a single plot. You can only specify a single format for all the parameters.

Mixer Spur

You use the mixer spur plot to understand how mixer nonlinearities affect output power at the desired mixer output frequency and at the intermodulation products that occur at the following frequencies:

fout=Nfin+MfLO

where

  • fin is the input frequency.

  • fLO is the local oscillator frequency.

  • N and M are integers.

The toolbox calculates the output power from the mixer intermodulation table (IMT). These tables are described in detail in the Visualizing Mixer Spurs example.

The mixer spur plot shows power as a function of frequency for an rfckt.mixer object or an rfckt.cascade object that contains a mixer. By default, the plot is three-dimensional and shows a stem plot of power as a function of frequency, ordered by the circuit index of the object. You can create a two-dimensional stem plot of power as a function of frequency for a single circuit index by specifying the index in the mixer spur plot command.

Consider the following cascaded network:

FirstCkt = rfckt.amplifier('NetworkData', ...
    rfdata.network('Type', 'S', 'Freq', 2.1e9, ...
    'Data', [0,0;10,0]), 'NoiseData', 0, 'NonlinearData', inf);
SecondCkt = read(rfckt.mixer, 'samplespur1.s2d');
ThirdCkt = rfckt.lcbandpasstee('L', [97.21 3.66 97.21]*1e-9, ...
    'C', [1.63 43.25 1.63]*1.0e-12);
CascadedCkt = rfckt.cascade('Ckts', ...
    {FirstCkt, SecondCkt, ThirdCkt});
The following figure shows how the circuit index is assigned to the components in the cascade, based on its sequential position in the network.

  • Circuit index 0 corresponds to the cascade input.

  • Circuit index 1 corresponds to the LNA output.

  • Circuit index 2 corresponds to the mixer output.

  • Circuit index 3 corresponds to the filter output.

You create a spur plot for this cascade using the plot method with the second argument set to 'mixerspur', as shown in the following command:

plot(CascadedCkt,'mixerspur')

Within the three dimensional plot, the stem plot for each circuit index represents the power at that circuit index. The following figure shows the mixer spur plot.

Mixer Spur Plot

For more information on mixer spur plots, see the plot reference page.

Polar Plots and Smith Charts

You can use the toolbox to generate Polar plots and Smith Charts. If you specify two or more parameters, the toolbox puts the parameters in a single plot.

The following table describes the Polar plot and Smith Chart options, as well as the available parameters.

Note

LS11, LS12, LS21, and LS22 are large-signal S-parameters. You can plot these parameters as a function of input power or as a function of frequency.

Plot Type

Method

Parameter

Polar plane

polar

S11, S12, S21, S22

LS11, LS12, LS21, LS22 (Objects with data from a P2D file only)

Z Smith chart

smithplot with type argument set to 'z'

S11, S22

LS11, LS22 (Objects with data from a P2D file only)

Y Smith chart

smithplot with type argument set to 'y'

S11, S22

LS11, LS22 (Objects with data from a P2D file only)

ZY Smith chart

smithplot with type argument set to 'zy'

S11, S22

LS11, LS22 (Objects with data from a P2D file only)

By default, the toolbox plots the parameter as a function of frequency. When you import block data from a .p2d or .s2d file, you can also plot parameters as a function of any operating condition from the file that has numeric values, such as bias.

Note

The circle method lets you place circles on a Smith Chart to depict stability regions and display constant gain, noise figure, reflection and immittance circles. For more information about this method, see the circle reference page or the two-part RF Toolbox example about designing matching networks.

For more information on a particular type of plot, follow the link in the table to the documentation for that method.

Compute and Plot Time-Domain Specifications

The toolbox lets you compute and plot time-domain characteristics for RF components.

This section contains the following topics:

Compute the Network Transfer Function

You use the s2tf function to convert 2-port S-parameters to a transfer function. The function returns a vector of transfer function values that represent the normalized voltage gain of a 2-port network.

The following code illustrates how to read file data into a passive circuit object, extract the 2-port S-parameters from the object and compute the transfer function of the data at the frequencies for which the data is specified. z0 is the reference impedance of the S-parameters, zs is the source impedance, and zl is the load impedance. See the s2tf reference page for more information on how these impedances are used to define the gain.

PassiveCkt = rfckt.passive('File','passive.s2p')
z0=50; zs=50; zl=50;
[SParams, Freq] = extract(PassiveCkt, 'S Parameters', z0);
TransFunc = s2tf(SParams, z0, zs, zl);

Fit a Model Object to Circuit Object Data

You use the rationalfit function to fit a rational function to the transfer function of a passive component. The rationalfit function returns an rfmodel object that represents the transfer function analytically.

The following code illustrates how to use the rationalfit function to create an rfmodel.rational object that contains a rational function model of the transfer function that you created in the previous example.

RationalFunc = rationalfit(Freq, TransFunc)

To find out how many poles the toolbox used to represent the data, look at the length of the A vector of the RationalFunc model object.

nPoles = length(RationalFunc.A)

Note

The number of poles is important if you plan to use the RF model object to create a model for use in another simulator, because a large number of poles can increase simulation time. For information on how to represent a component accurately using a minimum number of poles, see Represent a Circuit Object with a Model Object.

See the rationalfit reference page for more information.

Use the freqresp method to compute the frequency response of the fitted data. To validate the model fit, plot the transfer function of the original data and the frequency response of the fitted data.

Resp = freqresp(RationalFunc, Freq);
plot(Freq, 20*log10(abs(TransFunc)), 'r', ...
    Freq, 20*log10(abs(Resp)), 'b--');
ylabel('Magnitude of H(s) (decibels)');
xlabel('Frequency (Hz)');
legend('Original', 'Fitting result');
title(['Rational fitting with ', int2str(nPoles), ' poles']);

Compute and Plot the Time-Domain Response

You use the timeresp method to compute the time-domain response of the transfer function that RationalFunc represents.

The following code illustrates how to create a random input signal, compute the time-domain response of RationalFunc to the input signal, and plot the results.

SampleTime=1e-11;
NumberOfSamples=4750;
OverSamplingFactor = 25;
InputTime = double((1:NumberOfSamples)')*SampleTime;
InputSignal = ...
     sign(randn(1, ceil(NumberOfSamples/OverSamplingFactor)));
InputSignal = repmat(InputSignal, [OverSamplingFactor, 1]);
InputSignal = InputSignal(:);

[tresp,t]=timeresp(RationalFunc,InputSignal,SampleTime);
plot(t*1e9,tresp);
title('Fitting Time-Domain Response', 'fonts', 12);
ylabel('Response to Random Input Signal');
xlabel('Time (ns)');

For more information about computing the time response of a model object, see the timeresp reference page.