# gammain

Calculate input reflection coefficient of two-port network

## Syntax

``coefficient = gammain(s_params,z0,zl)``
``coefficient = gammain(hs,zl)``

## Description

example

````coefficient = gammain(s_params,z0,zl)` calculates the input reflection coefficient of a two-port network. `z0` is the reference impedance Z0; its default value is 50 ohms. `zl` is the load impedance Zl; its default value is also 50 ohms. `coefficient` is an M-element complex vector.```

example

````coefficient = gammain(hs,zl)` calculates the input reflection coefficient of the two-port network represented by the S-parameter object `hs`.```

## Examples

collapse all

Calculate the input reflection coefficients at each index of an S-parameter array.

``` ckt = read(rfckt.amplifier,'default.s2p'); s_params = ckt.NetworkData.Data; z0 = ckt.NetworkData.Z0; zl = 100; coefficient = gammain(s_params,z0,zl)```
```coefficient = 191×1 complex -0.7247 - 0.4813i -0.7323 - 0.4707i -0.7397 - 0.4601i -0.7470 - 0.4495i -0.7542 - 0.4389i -0.7612 - 0.4284i -0.7682 - 0.4179i -0.7750 - 0.4075i -0.7817 - 0.3972i -0.7883 - 0.3870i ⋮ ```

Define a S-parameters object from a file.

` s_params = sparameters('default.s2p');`

` zl = 100;`

Calculate the input reflection coefficients at each index of a `sparameters` object.

` coefficient = gammain(s_params,zl)`
```coefficient = 191×1 complex -0.7247 - 0.4813i -0.7323 - 0.4707i -0.7397 - 0.4601i -0.7470 - 0.4495i -0.7542 - 0.4389i -0.7612 - 0.4284i -0.7682 - 0.4179i -0.7750 - 0.4075i -0.7817 - 0.3972i -0.7883 - 0.3870i ⋮ ```

## Input Arguments

collapse all

Two-port S-parameters, specified as a complex 2-by-2-by-M array. M is the number of two-port S-parameters.

Data Types: `double`

Reference impedance, specified as a positive scalar.

Data Types: `double`

Load impedance, specified as a positive scalar.

Data Types: `double`

Two-port network, specified as an S-parameter object.

Data Types: `function_handle`

## Output Arguments

collapse all

Input reflection coefficient, returned as a M element complex vector.

## Algorithms

`gammain` uses the equation:

`${\Gamma }_{in}={S}_{11}+\frac{\left({S}_{12}{S}_{21}\right){\Gamma }_{L}}{1-{S}_{22}{\Gamma }_{L}}$`

where

`${\Gamma }_{L}=\frac{{Z}_{l}-{Z}_{0}}{{Z}_{l}+{Z}_{0}}$`