This example shows how to programmatically perform an RF budget analysis of an RF receiver system and visualize computed budget results across the bandwidth of the input signal.
First, use amplifier, modulator, rfelement, and nport objects to specify the 2-port RF elements in a design. Then compute RF budget results by cascading the elements together into an RF system with rfbudget.
The rfbudget object enables design exploration and visualization at the MATLAB command-line or graphically in the rfBudgetAnalyzer app. It also enables automatic RF Blockset model and measurement testbench generation.
RF system designers typically begin a design process with budget specifications for the gain, noise figure (NF), and nonlinearity (IP3) of the entire system.
MATLAB functionality supporting RF budget analysis makes it easy to visualize gain, NF and IP3 results at multiple frequencies throughout the bandwidth of the signal. You can:
Programmatically build an rfbudget object out of 2-port RF elements.
Use the command-line display of the rfbudget object to view single-frequency budget results.
Vectorize the input frequency of the rfbudget object and use MATLAB plot to visualize RF budget results across the bandwidth of the input signal.
In addition, with an rfbudget object you can:
Use export methods to generate MATLAB scripts, RF Blockset models, or measurement testbenches in Simulink.
Use show to copy an rfbudget object into the rfBudgetAnalyzer app.
A basic RF receiver consists of an RF filter, an RF amplifier, a demodulator, an IF filter, and an IF amplifier.
First build and parameterize each of the 2-port RF elements. Then use rfbudget to cascade the elements with input frequency 2.1 GHz, input power -30 dBm, and input bandwidth 45 MHz.
f1 = nport('RFBudget_RF.s2p','RFBandpassFilter'); a1 = amplifier('Name','RFAmplifier', ... 'Gain',11.53, ... 'NF',1.53, ... 'OIP3',35); d = modulator('Name','Demodulator', ... 'Gain',-6, ... 'NF',4, ... 'OIP3',50, ... 'LO',2.03e9, ... 'ConverterType','Down'); f2 = nport('RFBudget_IF.s2p','IFBandpassFilter'); a2 = amplifier('Name','IFAmplifier', ... 'Gain',30, ... 'NF',8, ... 'OIP3',37); b = rfbudget('Elements',[f1 a1 d f2 a2], ... 'InputFrequency',2.1e9, ... 'AvailableInputPower',-30, ... 'SignalBandwidth',45e6);
Scalar frequency results can be viewed simply by using MATLAB disp to see the results at the command-line.
Each column of the budget shows the results of cascading only the elements of the previous columns. The final column shows the RF budget results of the entire cascade.
rfbudget with properties: Elements: [1x5 rf.internal.rfbudget.Element] InputFrequency: 2.1 GHz AvailableInputPower: -30 dBm SignalBandwidth: 45 MHz AutoUpdate: true Analysis Results OutputFrequency: (GHz) [ 2.1 2.1 0.07 0.07 0.07] OutputPower: (dBm) [-31.53 -20 -26 -27.15 2.847] TransducerGain: (dB) [-1.534 9.996 3.996 2.847 32.85] NF: (dB) [ 1.533 3.064 3.377 3.611 7.036] OIP3: (dBm) [ Inf 35 28.97 27.82 36.96] IIP3: (dBm) [ Inf 25 24.97 24.97 4.116] SNR: (dB) [ 65.91 64.38 64.07 63.83 60.41]
Use the budget's rfplot function to produce report-ready plots of cumulative RF budget results versus a range of cascade input frequencies. Cumulative (i.e. terminated sub-cascade) results are automatically computed to show the variation of the RF budget result through the entire design. Use the data cursor of the figure window to interactively explore values at different frequencies at different stages.
Use the RF budget smithplot/polar function to produce plots of cumulative RF budget sparameter results versus a range of cascade input frequencies. Use smithplot function to view reflection coefficients and polar to view reflection and transmission coefficients.
The rfbudget object has other useful MATLAB methods:
Use the show command to copy a single-frequency rfbudget object into the rfBudgetAnalyzer app. The Plot, Smith, and Polar button in the app, with its pull-down options, calls rfplot, smithplot, and polar respectively.
In the app, the Export button copies the current design to an rfbudget object in the MATLAB workspace. All of the other export methods of the RF budget object are available through the pulldown options of the Export button.
If you have written a 'myfile.m' script that builds your design and visualizes it with rfplot commands, try the publish('myfile.m') function at the command line (or click the Publish button in the MATLAB editor). This automatically generates all figures and produces a report for your colleagues, saved as an html file.
To save your design, first undock using the commands shown below and then use the Figure Toolbar to pulldown the File Menu and save using File -> Save As and select the Save as type to png or pdf. To redock the figure window into the app you can click the Dock affordance on the upper right corner of the figure window.
% h = findall(0,'type','figure','name','untitled'); % set(h,'WindowStyle','normal') % set(h,'MenuBar','figure') % set(h,'ToolBar','auto')