Code covered by the BSD License  

Highlights from
Testbench to determine the harmonic order of a SimRF Circuit Envelope simulation

image thumbnail

Testbench to determine the harmonic order of a SimRF Circuit Envelope simulation

by

 

Determine the harmonic order to find the best tradeoff between simulation time and accuracy.

TestbenchScript.m
%% Testbench to determine the Harmonic Order of a Circuit Envelope simulation
% This testbench shows how to determine the harmonic order of a SimRF
% Circuit Envelope simulation for a non-linear system by examining results
% in the time and in the frequency domain. The harmonic order of a Circuit
% Envelope simulation has impact on the simulation accuracy and speed. In
% general high harmonic order provides more accurate results but it is
% slower to simulate. As a user, you might want to determine the harmonic  
% order and find the best tradeoff between simulation speed and accuracy. 
%
% Copyright 2013 The MathWorks, Inc.

%% To step along in sections use the "run and Advance" icon in the R2013A Editor.
%% Open the Simulink / SimRF model
model = 'Testbench';
open_system(model)

%% Set the non-linear specifications of the mixer / amplifier
set_param([model '/Mixer'],'IP2', '20');
set_param([model '/Mixer'],'IP3', '30');

set_param([model '/Amplifier'],'IP3', '46');
set_param([model '/Amplifier'],'P1dB', '33');

%% Run the time domain simulation with high harmonic order
HO_RF = 9;
HO_LO = 9;
% Use a time-varying envelope signal
set_param([model,'/Modulation Select'],'sw','0'); % 0 is down, 1 is up.
% Run the simulation 
sim(model, 0.97e-3);

%% Frequency domain analysis
% Use a constant envelope signal
set_param([model,'/Modulation Select'],'sw','1'); % 0 is down, 1 is up.
% Set the stop-time equal to zero for a static harmonic balance analysis
sim(model, 0);

%% Change the Harmonic Order of the simulation
HO_RF = 7;
HO_LO = 5;
% Update the Simulink diagram
Testbench([],[],[],'sizes');

%% Run the time domain simulation with reduced harmonic order
% Use a time-varying envelope signal
set_param([model,'/Modulation Select'],'sw','0'); % 0 is down, 1 is up.
% Run the simulation 
sim(model, 0.97e-3)

%% Conclusions
% This testbench shows the impact of the harmonic order on a SimRF Circuit 
% Envelope simulation of a simple RF receiver. It allows you to inspect the
% results in the time and in the frequency domains, and shows how to
% perform an harmonic balance analysis in static conditions.
% With this testbench you can determine the harmonic order using 
% qualitative and quantitative measures and find the most suitable tradeoff 
% between simulation speed and accuracy.

Contact us