Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Model RF Filter Using Circuit Envelope

This example shows how to model an RF filter using Circuit Envelope Library. In this example you compare the input and output signal amplitudes to study the signal attenuation.

Model Overview

This example uses an LC bandpass filter designed to have a bandwidth of 200 MHz. The filter uses a three tone input signal to demonstrate the filter attenuation property for in-band and out-band frequencies. The input signal tones are:

  • 700 MHz — Center frequency of the filter passband

  • 600 MHz — Lower edge frequency of the filter passband

  • 900 MHz — Frequency outside the filter passband

Define Model Variables and Settings

Define model variables for blocks that share parameter values using the InitFcn:

  1. In Simulink® editor, select File > Model Properties > Model Properties.

  2. In the Model Properties dialog box, on the Callbacks tab in Model callbacks pane, select InitFcn.

  3. In the Model initialization function pane, enter:

    amp = ones(1,3)
    freq = [600 700 900]*1e6
    stepsize = 1/500e6
  4. Click OK.

  5. In the Simulink tool bar, change the Simulation stop time to 0.

  6. In Simulink editor, select Simulation > Model configuration Parameters. In the Configuration Parameters dialog box, on the Solver tab, in Solver options change the Solver to discrete (no continuous states).

Required Blocks

The filter system consists of LC Ladder, Inport, Outport and Configuration blocks. The physical part of the model uses bidirectional RF signals.

The blocks used in the system are:

Block

Library Path

Description

Quantity

ConstantSimulink > Sources

Generates real and complex constant value

1

InportRF Blockset > Circuit Envelope > Utilities

Convert Simulink input signal to RF Blockset™ input signal

1

ConfigurationRF Blockset > Circuit Envelope > Utilities

Set the system wide parameters for RF Blockset simulation

1

LC LadderRF Blockset > Circuit Envelope > Elements

Models the signal attenuation caused by the LC Ban

1

OutportRF Blockset > Circuit Envelope > Utilities

Convert RF Blockset signals to Simulink Signals

1

db ConversionDSP System Toolbox > Math Functions > Math Operations

Convert magnitude data to decibels

2

Math FunctionSimulink > Math Operations

Performs mathematical function.

2

To workspaceSimulink > Sinks

Write data to a MATLAB® workspace for plotting

2

TerminatorSimulink > Commonly Used Blocks > Terminator

Terminate the angle baseband output of the Outport block

1

Connect the blocks as shown in the figure:

Configure Input Signal

Generate the three-tone input signal using these blocks:

  • Constant block specifies the amplitude of the signal.

  • Inport block configures the frequencies of the three tones.

  • Configuration block specifies the stepsize.

  1. In the Constant block dialog box set the Constant value to amp, as defined in the InitFcn.

  2. In the Inport block:

    • Set Source type to Power.

    • Set Carrier frequencies to freq, as defined in InitFcn. The freq variable sets the frequency of the three tones to 600 MHz, 700 MHz, and 900 MHz respectively.

      Click OK.

  3. In the Configuration block dialog box:

    • Set Step size to stepsize, as defined in InitFcn.

    • Clear Simulate noise.

      Click OK.

    The fundamental tones and harmonics are updated automatically when you run the model.

Configure RF Filter

  1. In the LC Ladder block dialogue box:

    • Set Ladder topology to LC Bandpass Pi.

      Click Apply and then click OK.

Configure Output Settings

  1. In the Outport block :

    • Set Sensor type to Power.

    • Set Output to Magnitude and Angle Baseband.

    • Set Carrier frequencies to freq, as defined in InitFcn.

      Click OK.

  2. In the Simulink editor, connect the Ang port of the Outport block to Terminator block to terminate the angle baseband output.

  3. In Math Function and Math Function 1 block dialog boxes, set Function to magnitude^2 and click OK. The block squares the magnitude of the input and output signal.

  4. In dB Conversion and dB Conversion 1 block dialog boxes, set Input Signal to Power and click OK. The block converts the input and output signals to dB.

  5. In To Workspace, change the Variable name to In. In To Workspace 1, change the Variable name to Out. In both the block dialog boxes, change the set Save format to Array and click OK.

  6. Use Simulation > Run to run the model.

Plot and Analyze Attenuated Output Signals

Display the input and output signals using semilogx function, in dB.

  1. Transfer the input and output dB values to the MATLAB workspace using To Workspace block.

  2. To view the input signal, plot In array from the MATLAB workspace :

    figure
    h = semilogx(freq, In,'-gs','LineWidth',1,...
    ...'MarkerSize',3,'MarkerFaceColor','r');
    xlim([5.5e8,9.5e8])
    xlabel('Frequency[Hz]')
    ylabel('Amplitude[dB]')
    title('Input Signal')
  3. To view the output signal, plot Out array from the MATLAB workspace :

    figure
    h = semilogx(freq, Out,'-gs','LineWidth',1,...
    ...'MarkerSize',3,'MarkerFaceColor','r');
    xlim([5.5e8,9.5e8])
    ylim([-25,1])
    xlabel('Frequency[Hz]')
    ylabel('Amplitude[dB]')
    title('Attenuated Output Signal')
  4. Compare the input and output signal plots to verify the attenuation caused by the filter.

    Input Signal to RF Filter

  5. The following plot shows the filtered attenuated signal.

    Attenuated Output Signal

    Notice that the RF filter does not attenuate the signal at the center frequency of 700 MHz.

Analyze LC Bandpass Filter Response

  1. Plot more points to better understand the response of the LC bandpass filter. Change the defined variables in Model Properties to :

    amp = ones(1,201)
    freq = logspace (8,10,201)
    stepsize = 1/500e6

  2. Run the model. Notice that the signal is not attenuated within the 200 MHz range of the LC bandpass filter.

  3. Plot the attenuated output:

    figure
    h = semilogx(freq, Out,'-gs','LineWidth',1...
    .............,'MarkerSize',3,'MarkerFaceColor','r');
    xlim([5.5e8,9.5e8])
    ylim([-25,1])
    xlabel('Frequency[Hz]')
    ylabel('Amplitude[dB]')
    title('LC Bandpass Filter Frequency Response')
    

Was this topic helpful?