Introduction to Stateflow with Applications

Chapter 4: Model Coverage for Embedded MATLAB Functions

This chapter describes the procedure for adding Embedded MATLAB functions to Stateflow charts. It begins with an introduction to Embedded MATLAB functions using an example, followed by procedures for building a Simulink model with a Stateflow chart that calls the Embedded MATLAB function.

4.1 Introduction to Embedded MATLAB Functions

Figure 4.1 below shows an example of a Stateflow Chart in a Simulink model and Model Coverage for an Embedded MATLAB function inside the Stateflow Chart.


Figure 4.1: Example with a Stateflow Chart that contains a Model Coverage for Embedded MATLAB function

The Stateflow documentation presents an example model named intersecting_rectangles where the if statement is tested for Decision Coverage. Other statements that can be tested for Decision Coverage are switch, for, and while. However, we can create a model without these statements as illustrated with the example below.

Example 4.1

Consider the electric circuit shown in Figure 4.2.


Figure 4.2: A parallel resonant frequency circuit

From electric circuit [*] theory, we know that the resonant frequency 0 is found from the relation


[ ]

or in terms of the radian frequency ? 0 from the relation


Often, we want to adjust the variable capacitor indicated with an arrow in Figure 4.2, to produce a desired resonant frequency. In practice, the value of the inductor is held fixed and the value of the capacitor is varied.

For our model, we want to set the value of the capacitor so that the radian resonant...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Resonators
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.