Products & Services Solutions Academia Support User Community Company

Learn more about Signal Processing Blockset   

Inspecting Sample Rates and Frame Rates

Sample Rate and Frame Rate Concepts

Sample rates and frame rates are important issues in most signal processing models. This is especially true with systems that incorporate rate conversions. Fortunately, in most cases when you build a Simulink model, you only need to set sample rates for the source blocks. Simulink automatically computes the appropriate sample rates for the blocks that are connected to the source blocks. Nevertheless, it is important to become familiar with the sample rate and frame rate concepts as they apply to Simulink models.

The input frame period (Tfi) of a frame-based signal is the time interval between consecutive vector or matrix inputs to a block. Similarly, the output frame period (Tfo) is the time interval at which the block updates the frame-based vector or matrix value at the output port.

In contrast, the sample period, Ts, is the time interval between individual samples in a frame, this value is shorter than the frame period when the frame size is greater than 1. The sample period of a frame-based signal is the quotient of the frame period and the frame size, M:

More specifically, the sample periods of inputs (Tsi) and outputs (Tso) are related to their respective frame periods by

where Mi and Mo are the input and output frame sizes, respectively.

The illustration below shows a single-channel, frame-based signal with a frame size (Mi) of 4 and a frame period (Tfi) of 1. The sample period, Tsi, is therefore 1/4, or 0.25 second.

The frame rate of a signal is the reciprocal of the frame period. For instance, the input frame rate would be . Similarly, the output frame rate would be .

The sample rate of a signal is the reciprocal of the sample period. For instance, the sample rate would be .

In most cases, the sequence sample period Tsi is most important, while the frame rate is simply a consequence of the frame size that you choose for the signal. For a sequence with a given sample period, a larger frame size corresponds to a slower frame rate, and vice versa.

Inspecting Sample-Based Signals Using the Probe Block

You can use the Probe block to display the sample period of a sample-based signal. For sample-based signals, the Probe block displays the label Ts, the sample period of the sequence, followed by a two-element vector. The left element is the period of the signal being measured. The right element is the signal's sample time offset, which is usually 0.

In this example, you use the Probe block to display the sample period of a sample-based signal:

  1. At the MATLAB command prompt, type doc_probe_tut1.

    The Probe Example 1 model opens.

  2. Run the model.

    The figure below illustrates how the Probe blocks display the sample period of the signal before and after each upsample operation.

    As displayed by the Probe blocks, the output from the Signal From Workspace block is a sample-based signal with a sample period of 1 second. The output from the first Upsample block has a sample period of 0.5 second, and the output from the second Upsample block has a sample period of 0.25 second.

Inspecting Frame-Based Signals Using the Probe Block

You can use the Probe block to display the frame period of a frame-based signal. For frame-based signals, the block displays the label Tf, the frame period of the sequence, followed by a two-element vector. The left element is the period of the signal being measured. The right element is the signal's sample time offset, which is usually 0.

In this example, you use the Probe block to display the frame period of a frame-based signal:

  1. At the MATLAB command prompt, type doc_probe_tut2.

    The Probe Example 2 model opens.

  2. Run the model.

    The figure below illustrates how the Probe blocks display the frame period of the signal before and after each upsample operation.

    As displayed by the Probe blocks, the output from the Signal From Workspace block is a frame-based signal with a frame period of 16 seconds. The output from the first Upsample block has a frame period of 8 seconds, and the output from the second Upsample block has a sample period of 4 seconds.

Note that the sample rate conversion is implemented through a change in the frame period rather than the frame size. This is because the Frame-based mode parameter in the Upsample blocks is set to Maintain input frame size rather than Maintain input frame rate.

Inspecting Sample-Based Signals Using Color Coding

In the following example, you use sample time color coding to view the sample rate of a sample-based signal:

  1. At the MATLAB command prompt, type doc_color_tut1.

    The Sample Time Color Example 1 model opens.

  2. From the Format menu, point to Sample Time Display, and select Colors.

    This selection turns on sample time color coding. Simulink now assigns each sample rate a different color.

  3. Run the model.

    The model should now look similar to the following figure:

    Every sample-based signal in this model has a different sample rate. Therefore, each signal is assigned a different color.

For more information about sample time color coding, see How to View Sample Time Information in the Simulink documentation.

Inspecting Frame-Based Signals Using Color Coding

In this example, you use sample time color coding to view the frame rate of a frame-based signal:

  1. At the MATLAB command prompt, type doc_color_tut2.

    The Sample Time Color Example 2 model opens.

  2. To turn on sample time color coding, from the Format menu, point to Sample Time Display, and select Colors.

    Simulink now assigns each frame rate a different color.

  3. Run the model.

    The model should now look similar to the following figure:

    Because the Frame-based mode parameter in the Upsample blocks is set to Maintain input frame size rather than Maintain input frame rate, each Upsample block changes the frame rate. Therefore, each frame-based signal in the model is assigned a different color.

  4. Double-click on each Upsample block and change the Frame-based mode parameter to Maintain input frame rate.

  5. Run the model.

    Every signal is coded with the same color. Therefore, every signal in the model now has the same frame rate.

For more information about sample time color coding, see Displaying Sample Time Colors in the Simulink documentation.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS