A minimal model takes an input signal, operates on it, and outputs the result. In the Library Browser, the Sources library contains blocks that represent input signals. The Sinks library has blocks for capturing and displaying outputs. The other libraries contain blocks you can use for a variety of purposes, such as math operations.
In this example of a basic model, the input is a sine wave, the operation is a gain (which increases the signal value by multiplying), and you output the result to a scope. Try different techniques to explore the library and to add blocks to your model.
Open the Sources library. In the tree view of the Library Browser, click the Sources library.
In the right pane, pause on the Sine Wave block to see a tooltip describing its purpose.
Add a block to your model. Right-click the Sine Wave block and select Add block to model untitled. To learn more about the block, right-click the block and select Help.
Add a block to your model by dragging. In the library tree view, click Math Operations. In the Math Operations library, locate the Gain block and drag it to your model to the right of the Sine Wave block.
In the library tree view, click Simulink to view the sublibraries as icons in the right pane. This view is an alternative way to navigate the library structure. Double-click the Sinks library icon.
In the Sinks library, locate the Scope block and add it to your model using the context menu or by dragging it.
The figure shows your model so far.
Note
The editor names blocks as you add them. For example, it names the first Gain block that you add Gain, the next Gain1, and so on. By default, the Simulink® Editor hides these names. However, you can see the name by selecting the block. You can also explicitly name a block so that the name appears. You can display all names given by the editor. In the Debug tab, select Information Overlays > Hide Automatic Block Names. For more information on displaying block names, see Manage Block Names and Ports.
Connect the blocks to create the relationships between model elements that are needed to make the model operate. Reading the model is easier when you line up blocks according to how they interact with each other. Shortcuts help you to align and connect blocks.
Drag a Gain block so it lines up with a Sine Wave block. An alignment guide appears when the blocks line up horizontally.
Release the block, and a blue arrow appears as a preview of the suggested connection.
To make the connection, click the arrow. A solid line appears in place of the guide.
Line up and connect the Scope block to the Gain block using the same technique. Additional guides appear when multiple blocks are within range.
Tip
For additional alignment options, on the Format tab, click options in the Align section.
You can set parameters on most blocks. Parameters help you to specify how a block operates in the model. You can use the default values or you can set values. Use the Property Inspector to set parameters. Alternatively, you can double-click most blocks to set the parameters using a block dialog box.
In your model, set the sine wave amplitude and the gain value.
Display the Property Inspector. On the Modeling tab, under Design, click Property Inspector.
Select the Sine Wave block.
In the Property Inspector, set the Amplitude parameter to
2
.
For blocks whose value appears on the icon, you can edit the parameter interactively. Select the Gain block. Pause on the block. A blue underline appears under the number.
Set the Gain parameter to 300000
. Click
the underlined number, delete it, and enter 300000
.
Blocks such as Constant and Gain blocks display a parameter value only when it fits on the block icon.
To resize the block so that it displays the parameter value, click the interactive cue.
Alternatively, use one of these options to resize the block so that it displays the parameter value:
In the Simulink Toolstrip, on the Format tab, select Fit to Content.
In the Simulink Editor, on the action bar that appears when you select the block and pause on the ellipsis, select Fit to Content.
In a block dialog box or in the Property Inspector, when you set a block parameter value to a variable or function, Simulink provides a suggested list to select from based on the current text typed in the edit field. The suggestions include relevant variables or objects from every workspace (base, model, and mask), data dictionary, and referenced dictionary visible to the editable block parameter. Autocomplete is available for variables, fields of structures and objects, and functions on the MATLAB® path.
open_system
| simulink
| Simulink.createFromTemplate
| Simulink.defaultModelTemplate
| Simulink.findTemplates