This is machine translation

Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Translate This Page

MathWorks Machine Translation

The automated translation of this page is provided by a general purpose third party translator tool.

MathWorks does not warrant, and disclaims all liability for, the accuracy, suitability, or fitness for purpose of the translation.

Navigate Model

Simulink® models are hierarchical, so you can build models using both top-down and
bottom-up approaches. You can view the system at a high level, then drill down to see
increasing levels of model detail. This approach provides insight into how a model is
organized and how parts interact.

To start, open the smart_braking model. In the MATLAB® Command Window, enter

The alarm automatically controls the brake to avoid hitting the obstacle.

Navigate Through Model Hierarchy

You connect blocks together to model complex components. In this model, Vehicle,
Proximity sensor, and Alert system are all complex components with multiple blocks, and they
exist in a hierarchy of subsystems. To view its contents, double-click any subsystem:

To view the complete tree, click the Hide/Show Model Browser button at the bottom left corner of the model window.

The Model Browser shows that all subsystems you view at the top level also have
subsystems of their own. Click > icons to see the subsystems. You can
navigate through the hierarchy in the Model Browser. For example, click the Sensor model
subsystem:

Observe that the subsystem is highlighted in the Model Browser. The address bar also
shows which subsystem you are viewing. To open the subsystem in a separate window instead,
right-click the subsystem name and select Open In New Window.

Every input or output port on a subsystem has a corresponding Inport or
Outport block inside the subsystem. These blocks indicate data transfer
between a subsystem and its parent. In the case of multiple inputs or outputs, the number on
the block designates which port it connects to on the subsystem.

View Signal Attributes

The signal lines in Simulink indicate data transfer from block to block. These signals have attributes
essential to the function of the model:

Size: Scalar, vector, or matrix

Data type: String, double, unsigned integer, etc.

Sample time: The fixed time interval at which this signal has an updated value, or
continuous sampling

To show the data type of all signals on a model, select Display > Signals
& Ports > Port Data Types:

The model displays data types along the signal types. Observe that most signals are
double, except the output of the Alert subsystem. Double-click this subsystem to investigate
why:

The labels in this subsystem suggests that data type change occurs in the Alert device
subsystem, double-click to investigate:

This shows that the Alert device component converts the alert index signal from a double
to an integer. You can set the data type at sources, or use a Data Type
Conversion block from the Signal Attributes library. The double data type, the
default, provides the best numerical precision and is supported in all blocks. It also uses
the most memory and computing power. Other numerical data types serve to model typical
embedded systems where memory and computing power are limited.

To show sample times, select Display > Sample Time > Colors.
This updates the model to show different colors for different sample times, and also
displays a legend:

A block or signal with continuous dynamics is black. They update as often as
Simulink requires to make the computations as close to the physical world as
possible.

A block or signal that is constant is magenta. They remain unchanged through
simulation.

A discrete block or signal that updates at the lowest fixed interval is red: They
update only at fixed intervals. If the model contains components with different fixed
sample times, each sample time has a different color.

A subsystem that contains continuous and discrete components are yellow: They are
hybrid systems.

Trace a Signal

This model has a constant source and a discrete output. To determine where the sampling
scheme changes., trace the output signal through blocks:

Open the Model Browser: Click the Hide/Show Model Browser
button .

Highlight the source of the output signal: Right-click the signal and select
Highlight Signal to Source.

This takes the editor into highlight mode. Click the editor to continue. Make sure
there is a blue frame around the editor.

To continue tracing the signal to its source, press the left arrow key.

Keep tracing the signal to its source until you reach the Alert logic subsystem. You
see that the Subtract block has two inputs. Choose the signal path from
the Inport by pressing the down arrow key.

To find the source of the discretization, keep pressing the left arrow and note the
colors of port names that reflect the sample time.

You find that the Zero-Order Hold block in the Sensor model subsystem does the
conversion from continuous to discrete.

MATLAB 명령

아래 MATLAB 명령에 해당하는 링크를 클릭하셨습니다.

이 명령을 MATLAB 명령 창에 입력해 실행하십시오.
웹 브라우저에서는 MATLAB 명령을 지원하지 않습니다.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .