SimRF 

This example shows how to use the SimRF™ Circuit Envelope library to test intermodulation distortion of an amplifier using twocarrier envelope analysis.
On this page… 

Performing TwoTone Analysis Using Circuit Envelope Simulation 
The system consists of:
A Simulink® sinusoidal input with frequency (f1f2)/2, and an Inport that assigns the input modulation to the carrier (f1+f2)/2. This formulation is equivalent to the sum of two sinusoids with frequency f1 and f2, according to the sumproduct formula for cosines:
An amplifier with specified 0 dB linear gain and 20 dB OIP3. For an input signal , the amplifier computes the output according to the polynomial
Two Outport blocks that probe the input and output voltages (across shunt resistors) at the carrier frequency.
The example model defines variables for block parameters using a callback function. To access model callbacks, select File > Model Properties > Model Properties and click the Callbacks tab in the Model Properties window.
Type open_system('simrfV2_power_imd') at the Command Window prompt.
Select Simulation > Run.
The resulting output power spectrum, labeled 'Output Power', shows thirdorder intermodulation distortion. The Display block shows the power of the bandpass waveform, which is half of power of the envelope waveform.
The input drives the nonlinear amplifier into compression, so the linear component of the output is attenuated. To simulate the amplifier in a linear region:
Specify Inf for the IP3 parameter of the Amplifier block located in the Nonlinearity tab of the dialog, or
Reduce the power of the input signal by decreasing the value of the Amplitude parameter of the Sine Wave block.
Performing TwoTone Analysis Using Circuit Envelope Simulation
This example takes advantage of the properties of real signalsnamely, the sumproduct equivalence of sinusoids. To perform the same experiment on a different RF system:
Choose f1 and f2, the frequencies of the test tones.
Use a Simulink Sine source and an Inport block to model modulation with frequency (f1f2)/2 on a carrier with frequency (f1+f2)/2. Alternatively, you can use a Sinusoid block from the SimRF Circuit Envelope library to specify both a modulation and a carrier simultaneously.
Specify (f1+f2)/2 as one of your carrier frequencies in the Configuration block dialog.
Use an Outport block to probe the distorted signal.
Connect a scope to the Outport block. If you have DSP System Toolbox™ installed, you can use tools like the Frequency Scope, Time Scope, and Spectrum Scope to visualize your signal in place of the FFT Stem subsystem used in the example.
Cripps, Steve C. RF Power Amplifiers for Wireless Communications. Artech House, Inc., 2006.