# Design RF Chain Using RF Antenna Object

This example shows how to design an RF chain using an `rfantenna` object.

### RF Antenna Transmitter and Receiver Elements

Create an RF antenna transmitter element. The properties of the RF antenna transmitter are as shown.

`Txant = rfantenna`
```Txant = rfantenna: Antenna element Name: 'Antenna' Type: 'Transmitter' Gain: 0 Z: 50 ```

Create an RF antenna receiver element. The properties of the RF antenna receiver are as shown.

`Rxant = rfantenna("Type","Receiver")`
```Rxant = rfantenna: Antenna element Name: 'Antenna' Type: "Receiver" Gain: 0 Z: 50 TxEIRP: -30 PathLoss: 0 ```

The `TxEIRP` property of the RF antenna receiver element is the effective isotropic radiated power (EIRP) from the transmitter to the receiver. This is essentially a power value falling on the receiver. The EIRP also takes into account the path loss. Path loss is specified in the `PathLoss` property of the receiver. Transmitter EIRP is calculated using this equation:

TxEIRP = Path Loss + Gain

### Use RF Antenna Receiver Element in RF Budget Chain

Calculate the RF budget of a series of RF elements by tying this command at the command line at the input frequency of 2.1 GHz, available input power of –30 dBm, and bandwidth of 10 MHz. The RF antenna receiver element must be the first element in the RF chain.

```a = amplifier; m = modulator; rfb = rfbudget([Rxant a m],2.1e9,-30,100e6) ```

MATLAB displays the warning message because the available input power is replaced by `TxEIRP`, the EIRP of the of the receiver.

Open the RF Budget Analyzer app to visualize RF budget chain using the `show` command at the command line.

```show(rfb) ```

The Available Input Power option is dimmed in the app when you add a receiver element. By default, the TxEIRP property has the same value as the Available Input Power option.

### Use RF Antenna Transmitter Element in RF Budget Chain

Calculate the RF budget of a series of RF elements by using the RF antenna transmitter as one of the elements. The RF antenna transmitter element must be the last element in the RF chain.

```a = amplifier; m = modulator; rfb = rfbudget([a m Txant],2.1e9,-30,100e6) ```

Open the RF Budget Analyzer app to visualize RF budget chain using the `show` command at the command line.

```show(rfb) ```

### Design RF Receiver Antenna Using Antenna Designer App

By default, the Antenna Source property of the RF antenna receiver element in the app set to `Isotropic Receiver`. Set the Antenna Source to `Antenna Designer`, which gives you the option of designing the antenna in the Antenna Designer app of the Antenna Toolbox. To use the Antenna Designer app or the Antenna Object, you need Antenna Toolbox™ license.

Click Create Antenna in the Element Parameters pane. The Antenna Designer app opens. Select New to explore the antenna library. This example uses a `dipoleFolded` antenna element with a center frequency of `2.1` GHz. Select the `Folded `element from the Antenna Gallery, set the Design Frequency to `2.1` MHz, and click Accept.

Select Update Element to update the `Antenna` element in the RF Budget Analyzer app. Select OK in the Confirm Update dialog box.

After importing the design to the RF Budget Analyzer app, select Apply.

### Design RF Receiver Antenna Using Antenna Object

Create a folded dipole antenna at 2.1 GHz in the MATLAB workspace.

```antenna = design(dipoleFolded,2.1e9) ```

Set the Antenna Source to `Antenna Object` in the RF Budget Analyzer app to design an antenna using antenna object.

Select the antenna in the Antenna Object field and click Apply.

Export the RF transmitter chain to RF Blockset™ by selecting the Export to Blockset option in the Export drop-down list.

Now export the RF receiver chain to RF Blockset by selecting the Export to Blockset option in the Export drop-down list.

The exported RF Blockset model shows that the RF transmitter chain does not have `TxEIRP` and `PathLoss` as input properties, and similarly, the RF receiver chain does not have `EIRP` and `Directivity` as its outputs.

When you export an RF receiver, the exported RF Blockset model only shows the values of the `Gain` and `Impedance` parameters, whereas, in case of an RF transmitter, all the transmit antenna parameters of an `rfantenna` object are exported to the model.