# calculate

Calculate specified parameters for rfckt objects or rfdata objects

## Syntax

``[data,parameters,frequency] = calculate(rfdataobject,parameter1,...,parameterN,format)``
``[data,parameters,frequency] = calculate(rfcktobject,parameter1,...,parameterN,format)``

## Description

example

````[data,parameters,frequency] = calculate(rfdataobject,parameter1,...,parameterN,format)` calculates the required parameters of the rfdata.data object, `rfdataobject` and returns them in a cell array, `data`.```
````[data,parameters,frequency] = calculate(rfcktobject,parameter1,...,parameterN,format)` calculates the required parameters of the rfckt object, `rfcktobject` and returns them in a cell array, `data`.```

## Examples

collapse all

Analyze a general transmission line of impedance, 50 ohms, phase velocity of 299792458 m/s, and line length of 0.01 meters for frequencies 1.0 GHz to 3.0 GHz.

```trl = rfckt.txline; f = 1e9:1.0e7:3e9; analyze(trl,f)```
```ans = rfckt.txline with properties: LineLength: 0.0100 StubMode: 'NotAStub' Termination: 'NotApplicable' Freq: 1.0000e+09 Z0: 50.0000 + 0.0000i PV: 299792458 Loss: 0 IntpType: 'Linear' nPort: 2 AnalyzedResult: [1x1 rfdata.data] Name: 'Transmission Line' ```

Calculate the S11 and S22 parameters in dB.

`[data,params,freq] = calculate(trl,'S11','S22','dB')`
```data=1×2 cell array {201x1 double} {201x1 double} ```
```params = 1x2 cell {'S_{11}'} {'S_{22}'} ```
```freq = 201×1 109 × 1.0000 1.0100 1.0200 1.0300 1.0400 1.0500 1.0600 1.0700 1.0800 1.0900 ⋮ ```

## Input Arguments

collapse all

RF data, specified as a handle of an `rfdata.data` object.

Example: ```rfdataobject = rfdata.data```;```[data,parameter,frequency] = calculate[rfdataobject]``` calculates and returns the cell array of data for the rfdata.data object, `rfdataobject`.

Data Types: `char` | `string`

RFCKT element, specified as a handle of an rfckt object.

Example: ```rfcktobject = rfckt.amplifier```;```[data,parameter,frequency] = calculate[rfcktobject]``` calculates and returns the cell array of data for the rfckt amplifier object, `rfcktobject`.

Data Types: `char` | `string`

Parameters of an rfckt object or rfdata.data object, specified as a character vector or string. Use the `listparameter` function to list the parameters of the specified rfckt object or rfdata.data object.

Example: ```rfcktobject = rfckt.amplifier```;`listparam(rfcktobject)`;You can use any of the parameter from the output of `listparam` in the calculate function.

Data Types: `char` | `string`

Format of output data, specified as a character vector or string. Use the `listformat` function to list the valid formats of the parameter values of the specified rfckt object or rfdata.data object.

Example: ```rfcktobject = rfckt.amplifier```;`listformat(rfcktobject,parameter)`;Lists the format of the specified `parameter` of the `rfcktobject`. You can then use this format value in the `calculate` function.

Example: Specify format as `Real` to compute the real part of the selected parameter. Specify format as `none` to return the parameters values unchanged.

Data Types: `char` | `string`

## Output Arguments

collapse all

Data of the rfckt element or rfdata.data object, returned as an n-element cell array.

Name of the parameters in `data` output, returned as an n-element cell array.

Frequencies at which the parameters are known, returned as vector.