# powergain

Power gain of 2-port network

## Syntax

• `g = powergain(s_params,z0,zs,zl,'Gt')`
• `g = powergain(s_params,z0,zs,'Ga')`
• `g = powergain(s_params,z0,zl,'Gp')`
• `g = powergain(s_params,'Gmag')`
• `g = powergain(s_params,'Gmsg')`
• `g = powergain(hs,zs,zl,'Gt')`
• `g = powergain(hs,zs,'Ga')`
• `g = powergain(hs,zl,'Gp')`
• `g = powergain(hs,'Gmag')`
• `g = powergain(hs,'Gmsg')`

## Description

````g = powergain(s_params,z0,zs,zl,'Gt')` calculates the transducer power gain of the 2-port network `s_params`.```
````g = powergain(s_params,z0,zs,'Ga')` calculates the available power gain of the 2-port network.```
````g = powergain(s_params,z0,zl,'Gp')` calculates the operating power gain of the 2-port network.```
````g = powergain(s_params,'Gmag')` calculates the maximum available power gain of the 2-port network.```
````g = powergain(s_params,'Gmsg')` calculates the maximum stable gain of the 2-port network.```
````g = powergain(hs,zs,zl,'Gt')` calculates the transducer power gain of the network represented by the S-parameter object `hs`.```
````g = powergain(hs,zs,'Ga')` calculates the available power gain of the network represented by the S-parameter object `hs`.```
````g = powergain(hs,zl,'Gp')` calculates the operating power gain of the network represented by the S-parameter object `hs`.```
````g = powergain(hs,'Gmag')` calculates the maximum available power gain of the network represented by the S-parameter object `hs`.```
````g = powergain(hs,'Gmsg')` calculates the maximum stable gain of the network represented by the S-parameter object `hs`.```

## Input Arguments

collapse all

### `hs` — 2-port S-parametersS-parameter object

2-port S-parameters, specified as an RF Toolbox™ S-parameter object.

### `s_params` — 2-port S-parametersarray of complex numbers

2-port S-parameters, specified as a complex 2-by-2-by-N array.

### `z0` — Reference impedance50 (default) | positive scalar

Reference impedance in ohms, specified as a positive scalar. If the first input argument is an S-parameter object `hs`, the function uses `hs.Impedance` for the reference impedance.

### `zl` — Load impedance50 (default) | positive scalar

Load impedance in ohms, specified as a positive scalar.

### `zs` — Source impedance50 (default) | positive scalar

Source impedance in ohms, specified as a positive scalar.

## Output Arguments

collapse all

### `g` — Power gainvector

Unitless power gain values, returned as a vector. To obtain power gain in decibels, use `10*log10(g)`.

If the specified type of power gain is undefined for one or more of the specified S-parameter values in `s_params`, the `powergain` function returns `NaN`. As a result, `g` is either `NaN` or a vector that contains one or more `NaN` entries.

## Examples

Calculate power gains for a sample 2-port network:

```s11 = 0.61*exp(j*165/180*pi); s21 = 3.72*exp(j*59/180*pi); s12 = 0.05*exp(j*42/180*pi); s22 = 0.45*exp(j*(-48/180)*pi); sparam = [s11 s12; s21 s22]; z0 = 50; zs = 10 + j*20; zl = 30 - j*40; %Calculate the transducer power gain of the network Gt = powergain(sparam,z0,zs,zl,'Gt') %Calculate the available power gain of the network Ga = powergain(sparam,z0,zs,'Ga') %Calculate the operating power gain of the network Gp = powergain(sparam,z0,zl,'Gp') %Calculate the maximum available power gain of the network Gmag = powergain(sparam,'Gmag') %Calculate the maximum stable power gain of the network Gmsg = powergain(sparam,'Gmsg')```