# Documentation

## Model a Direct Conversion Receiver

Direct-conversion receivers are sensitive to second-order intermodulation products because they transfer the RF signal directly to baseband.

### Create a Direct Conversion Receiver Model

The model `ex_simrf_dc` models a direct-conversion receiver within the SimRF™ environment. The RF system consists of a low-noise amplification (LNA) stage, a direct-conversion stage, and a final amplification stage.

To open this model, at MATLAB® command line, enter:

```addpath(fullfile(docroot,'toolbox','simrf','examples')) ex_simrf_dc```

To run the model:

1. Open the model by clicking the link or by typing the model name at the Command Window prompt.

2. Select Simulation > Run.

#### Set Up the SimRF Environment

The model runs according to the following environment settings:

• In the Configuration dialog box, the Fundamental tones parameter specifies the carriers in the SimRF environment:

• fRF = fLO, the carrier of the RF and the local oscillator.

• fBL, the blocker carrier

The SimRF environment always simulates the 0 Hz carrier, regardless of whether the SimRF Parameters block specifies it.

• In the Solver Configuration dialog box, the Use local solver box is selected. This setting causes the SimRF environment to simulate with a local solver with the following settings:

• Solver type is ```Trapezoidal rule```.

• Sample time is `sample_time`, defined as `1.25e-4` in the model initialization function.

Since the model uses a local solver, the global solver settings do not affect the simulation within the SimRF environment. For more information on global and local solvers, see Choosing Simulink® and Simscape™ Solvers.

To maximize performance, the Fundamental tones and Harmonic order parameters specify the simulation frequencies explicitly in the Configuration block:

• fRF = fLO, the carrier of the RF and the local oscillator, appears as a fundamental tone.

• fBL, the blocker carrier, appears as a fundamental tone.

• A carrier of 0 Hz, representing the passband signal, is included in the set of first-order harmonics of both fundamental tones. Therefore, setting Harmonic order to `1` is sufficient to ensure this frequency appears in the simulation frequencies. This minimal value for the harmonic order ensures a minimum of simulation frequencies.

Solver conditions and noise settings are also specified for the Configuration block:

• The Solver type is set to `auto`. For more information on choosing solvers, see the reference page for the Configuration block or see Choosing Simulink and Simscape Solvers.

• The Sample time parameter is set to `sample_time`, which is equal to `1/(mod_freq*64)`. This setting ensures a simulation bandwidth 64 times greater than the envelope signals in the system.

• The Simulate noise box is checked, so the environment includes noise parameters during simulation.

#### View Simulation Output

The model uses subsystems with a MATLAB Coder™ implementation of a fast Fourier transform (FFT) to generate four plots:

• The RF Display plot shows the power level of the RF signal.

The power level of the RF is about 100 dBm.

• The Blocker Display plot shows the power spectrum centered at the carrier fBL..

The power level of the blocker is about 90 dB higher than the signal power of the RF..

• The In-Phase Output plot shows the power spectrum of the in-phase signal at baseband.

In the figure, DC power is a direct result of the blocker and the IP2 in the mixers.

• The Quadrature Output plot shows the power spectrum of the quadrature signal at baseband.

If you have DSP System Toolbox™ software installed, you can replace the MATLAB Coder subsystems with Vector Scope or Spectrum Analyzer blocks.

### Modeling IMD in System-Level Components

The IP2 and IP3 parameters specify the second- and third-order intercept points of Amplifier and Mixer blocks:

• The amplifiers have infinite IP2 and IP3, so the amplifiers are linear.

• IP2 of the mixer is `15` dB

Amplifier and Mixer components have specified gains and noise figures:

• The gain and noise figure in the LNA stage are 25 dB and 6 dB, respectively.

• The gain and noise figure in the mixing stage are 10 dB and 10 dB. The Input impedance (ohms) parameters of the two mixers are both `100`, which sum in parallel to a resistance of 50 Ω to match the output impedance of the LNA.

• The gain and noise figure in the final amplification stage are 20 dB and 15 dB, respectively.

To calculate RF system noise figure, use the Friis equation:

${F}_{sys}={F}_{1}+\frac{{F}_{2}-1}{{G}_{1}}+\frac{{F}_{3}-1}{{G}_{1}{G}_{2}}+...+\frac{{F}_{n}-1}{{G}_{1}{G}_{2}...{G}_{n-1}}$

where Fi and Gi are the noise factor and gain of the ith stage. For more information on RF system noise figure, see the featured example Impact of an RF Receiver on Communication System Performance.

### Examining DC Impairments

In addition to intermodulation distortion from IP2, direct-conversion receivers are subject to additional DC impairments. For example, coupling between mixer input and local oscillator (LO) ports causes self-mixing of the LO. For more information, see the featured example Executable Specification of a Direct Conversion Receiver