Accelerating the pace of engineering and science

# calculate

Calculate specified parameters for circuit object

## Syntax

[data,params,freq] = calculate(h,'parameter1',...,'parametern', 'format')
[ydata,params,xdata] = calculate(h,'parameter1',...,'parametern', 'format',xparameter,xformat, 'condition1',value1,...,'conditionm',valuem, 'freq',freq,'pin',pin)

## Description

[data,params,freq] = calculate(h,'parameter1',...,'parametern', 'format') calculates the specified parameters for the object h and returns them in the n-element cell array data.

The input h is the handle of a circuit object.

parameter1, ..., parametern is the list of parameters to be calculated. Use the listparam method to get a list of the valid parameters for a circuit object.

format is the format of the output data. The format determines if RF Toolbox™ software converts the parameter values to a new set of units, or operates on the components of complex parameter values.

For example:

• Specify format as Real to compute the real part of the selected parameter.

• Specify format as 'none' to return the parameter values unchanged.

Use the listformat method to get a list of the valid formats for a particular parameter.

The output params is an n-element cell array containing the names, as strings, of the parameters in data. freq is a vector of frequencies at which the parameters are known.

 Note:   Before calling calculate, you must use the analyze method to perform a frequency domain analysis for the circuit object.

[ydata,params,xdata] = calculate(h,'parameter1',...,'parametern', 'format',xparameter,xformat, 'condition1',value1,...,'conditionm',valuem, 'freq',freq,'pin',pin) calculates the specified parameters at the specified operating conditions for the object h.

xparameter is the independent parameter for which to calculate the specified parameters. Several xparameter values are available for all objects. When you import rfckt.amplifier, rfckt.mixer, or rfdata.data object specifications from a .p2d or .s2d file, you can also specify any operating conditions from the file that have numeric values, such as bias.

The following table shows the most commonly available parameters and the corresponding xparameter values. The default settings listed in the table are used if xparameter is not specified.

Parameter Namexparameter values
Pout, Phase, LS11, LS12, LS21, LS22Pin (default), Freq
S11, S12, S21, S22, NF, IIP3, OIP3, GroupDelay, VSWRIn, VSWROut, GammaIn, GammaOut, FMIN, GammaOPT, RN, TF1, TF2, Gt, Ga, Gp, Gmag, Gmsg, GammaMS, GammaML, K, Delta, Mu, MuPrimeFreq
AM/AM, AM/PMAM (default, and only available value)

xformat is the format to use for the specified xparameter. No xformat specification is needed when xparameter is an operating condition.

The following table shows the xformat values that are available for the xparameter values listed in the preceding table, along with the default settings that are used if xformat is not specified.

xparameter valuesxformat values
PindBm (default), mW, W, dBW
Freq

THz, GHz, MHz, KHz, Hz

By default, xformat is chosen to provide the best scaling for the given xparameter values.

AMMagnitude (decibels) (default), Magnitude (linear)

condition1,value1, ..., conditionm,valuem are the optional condition/value pairs at which to calculate the specified parameters. These pairs are usually operating conditions from a .p2d or .s2d file. For some parameters, you can specify a set of frequency or input power values at which to calculate the specified parameter.

For example:

• When you calculate large-signal S-parameters as a function of input power, you can specify frequency points of interest using condition/value pairs.

• When you calculate large-signal S-parameters as a function of frequency, you can specify input power levels of interest using condition/value pairs.

• When you calculate parameters as a function of an operating condition, you can specify both frequency and input power values using condition/value pairs.

freq is the optional frequency value at which to calculate the specified parameters.

pin is the optional input power value at which to calculate the specified parameters.

The method returns the following n-element cell arrays:

• ydata — The calculated values of the specified parameter.

• params — The names, as strings, of the parameters in xdata and ydata.

• xdata — The xparameter values at which the specified parameters are known.

 Note:   For compatibility reasons, if xdata contains only one vector or if all xdata values are equal, then xdata is a numeric vector rather than a cell of a single vector.

If h has multiple operating conditions, such as from a .p2d or .s2d file, the calculate method operates as follows:

• If you do not specify any operating conditions as arguments to the calculate method, then the method returns the parameter values based on the currently selected operating condition.

• If one or more operating conditions are specified, the calculate method returns the parameter values based on those operating conditions.

• When an operating condition is used for the xparameter input argument, the xdata cell array returned by the calculate method contains the operating condition values in ascending order.

## Examples

Analyze a general transmission line, trl, with the default characteristic impedance of 50 ohms, phase velocity of 299792458 meters per second, and line length of 0.01 meters for frequencies of 1.0 GHz to 3.0 GHz. Then, calculate the S11 and S22 parameters in decibels.

```trl = rfckt.txline;
f = [1e9:1.0e7:3e9];
analyze(trl,f);
[data,params,freq] = calculate(trl,'S11','S22','dB')

data =
[201x1 double]    [201x1 double]
params =
'S_{11}'    'S_{22}'

freq = 1.0e+009 *

1.0000
1.0100
1.0200
...```

The params output is formatted so you can use it as a plot legend. The first few elements of data{1} look like

```ans =

1.0e+003 *

-6.4661
-0.3372
-0.3432
-0.3432
-0.3432
...
```

## See Also

Was this topic helpful?