# insertUnitElement

Insert unit element into circuit object

## Syntax

``unitEle = insertUnitElement(cktIn,cktElem,elePort,opFreq,Z0)``

## Description

example

````unitEle = insertUnitElement(cktIn,cktElem,elePort,opFreq,Z0)` inserts a new circuit with unit element `unitEle` into a circuit object `cktIn` at a given reference frequency `opFreq` and characteristic impedance `Z0`. The `cktElem` and `elePort` together determine the position of insertion of the unit element.```

## Examples

collapse all

Create a lowpass LC-Pi Chebyshev filter with a passband frequency of 1 GHz, a passband attenuation of 0.5 dB, and a filter order of 5.

```Fp = 1e9; Ap = 0.5; Ord = 5; r = rffilter(FilterType="Chebyshev",ResponseType="Lowpass",Implementation="LC Pi",PassbandFrequency= ... Fp,PassbandAttenuation=Ap,FilterOrder=Ord);```

Convert the lumped elements of the RF filter to a distributed element using Richards' transformation.

`ri = richards(r,1e9)`
```ri = circuit: Circuit element ElementNames: {'C_tx' 'L_tx' 'C_1_tx' 'L_1_tx' 'C_2_tx'} Elements: [1x5 txlineElectricalLength] Nodes: [0 1 2 3 4 5 6] Name: 'unnamed' NumPorts: 2 Terminals: {'p1+' 'p2+' 'p1-' 'p2-'} ```

Insert a unit element at the edges of the circuit `ri` and the first circuit element `C_tx` at port `1`, which operates at 1 GHz and has a characteristic impedance of 50 ohms.

`unitEle = insertUnitElement(ri,'C_tx',1,1e9,50)`
```unitEle = circuit: Circuit element ElementNames: {1x6 cell} Elements: [1x6 txlineElectricalLength] Nodes: [0 1 2 3 4 5 6 7] Name: 'unnamed' NumPorts: 2 Terminals: {'p1+' 'p2+' 'p1-' 'p2-'} ```

Insert a unit element at the edges of the circuit `unitEle` and the last circuit element `C_2_tx` at port `2`, which operates at 1 GHz and has a characteristic impedance of 50 ohms.

`unitEle = insertUnitElement(unitEle,'C_2_tx',2,1e9,50)`
```unitEle = circuit: Circuit element ElementNames: {1x7 cell} Elements: [1x7 txlineElectricalLength] Nodes: [0 1 2 3 4 5 6 7 8] Name: 'unnamed' NumPorts: 2 Terminals: {'p1+' 'p2+' 'p1-' 'p2-'} ```

Apply Kuroda's transformation on the group of two elements.

`outObj = kuroda(unitEle,'C_tx_p1_elem_UE','C_tx')`
```outObj = circuit: Circuit element ElementNames: {1x7 cell} Elements: [1x7 txlineElectricalLength] Nodes: [0 1 2 3 4 5 6 7 8] Name: 'unnamed' NumPorts: 2 Terminals: {'p1+' 'p2+' 'p1-' 'p2-'} ```

## Input Arguments

collapse all

RF circuit object, specified as a `circuit` object. Before inserting the unit element you must first apply Richards' transformation.

Circuit element, specified as an index in the circuit or element names. The function inserts the unit element in a port of the circuit element you specify.

Port number of the circuit element for inserting the unit element, specified as a positive scalar.

Operating frequency at which the unit element is defined with LineLength = `pi/4` radians, specified as a positive scalar.

Characteristic impedance of the unit element, specified as a positive scalar.

## Output Arguments

collapse all

Unit element, returned as a `cktIn` object. The output is a circuit similar to `cktIn`, but with a unit element inserted.

The unit element is placed at the port `elePort` of the element of the circuit, `cktElem`. If `cktElem` is empty, `0` or `numel(INOBJ.Elements)+1`, the unit element is inserted at a port of the circuit `cktIn` itself.

## Version History

Introduced in R2021b