Suppose that you want to perform another gain but on the absolute value of the output from the Sine Wave block. Add blocks for this purpose, trying different techniques for locating blocks in the library and adding them to your model.
If you know the name of the block that you want to add, you can use a shortcut. Double-click where you want to add the block, and type the block name, in this case Gain.
The list of suggestions shown are dynamically ranked based on your recent block usage history.
Click the block name or, with the block name highlighted, press Enter. You can use the arrow keys to highlight the block name if it is not first in the list.
Some blocks display a prompt for you to enter a value for one of the block
parameters. The Gain block prompts you to enter the
Gain value. Type
3 and press
To perform an absolute value, add an Abs block. Suppose you do not
know the library a block is in or the full name of the block. You can search for it
using the search box in the Library Browser. Enter
abs in the
search box and press Enter. When you find the Abs block, add it to
the left of the new Gain block.
Add another Scope block. You can right-click the existing Scope block and drag to create the copy or use the Copy and Paste commands.
The figure shows the current state of the model.
The input to the second Gain block is the absolute value of the output from the Sine Wave block. To use a single Sine Wave block as the input to both gain operations, create a branch from the Sine Wave block output signal.
For the first set of blocks in your model, you used the horizontal alignment guides to help you align and connect them. You can also use guides to align blocks vertically. Drag the second Scope block so that it lines up under the first one. Release it when the vertical alignment guide shows that the blocks are aligned.
You can click two ports to connect them. After you click the first port, compatible ports appear highlighted. Click another port to connect.
Align and connect the blocks as shown.
Create a branch from the Sine Wave block output to the Abs block. Click the input port of the Abs block. Move the cursor toward the output signal line from the Sine Wave block. A preview line appears. Click to create the branch.
Alternatively, you can start the branch by clicking the line segment and then moving the cursor toward the port.
Name signals. Double-click the signal between the lower Gain block and the Scope
block and type
Scope. Double-click the line and not a blank area of
the canvas. For other techniques that you can use with signal names, see Signal Name and Label Actions.
Try these methods to add or connect blocks:
Drag from a block port and release so that a red, dotted line appears. Double-click the end of the line to use the block insertion shortcut. Suggested blocks for the current context appear on the menu. You can select one of the listed blocks.
To improve the menu suggestions based on your model designs, see Improve Quick Block Insert Results.
Double-click and then type the name of a block to get a list of blocks that starts with the characters you typed. For custom library blocks, you can type the block keyword if the library author assigned one. The list is ranked based on your recent block-usage history.
After you click a port, hold Shift as you connect to another port. Holding Shift puts you in a mode in which you can make multiple, consecutive connections. For example, while holding Shift, you can branch a new signal line and connect it to another port or signal line with one click.
Select the first block and Ctrl+click the block you want to connect it to. This technique is useful when you want to connect blocks that have multiple inputs and outputs, such as multiple blocks to a bus or two subsystems with multiple ports. As with clicking two ports, this technique is useful when you do not want to align blocks. The signal line bends as needed to make the connection.
To approximate a diagonal line from line segments, press Shift and drag a vertex.
To improve the shape of a signal line, select the line and, from the action bar, select Auto-route Line. The line redraws if a better route between model elements is possible. You can select Auto-route Lines from the action bar to improve lines with a single block selected or with multiple model elements selected by dragging a selection box.
You can group blocks in subsystems and label blocks, subsystems, and signals. For more information about subsystems, see Create a Subsystem.
Drag a selection box around the Abs block and the Gain block next to it.
Move the cursor over the ellipses that appear at the corner of the box where you ended the selection. From the action bar, select Create Subsystem.
A subsystem block appears in the model in place of the selected blocks. The subsystem block displays the input and output port indexes.
You can place a port on any side of the subsystem block. To move a port, click and drag it around the block.
To resize the subsystem block for the best fit in your model, drag the block handles.
Give the subsystem a meaningful name. Select the block, double-click the name, and
Absolute Value. Naming a block causes the name to appear in
Open the Absolute Value subsystem by double-clicking it.
To use the Explorer Bar to navigate the model hierarchy, right-click the subsystem and select Open in New Tab.
The subsystem contains the blocks and signal that you selected as the basis of the subsystem. They are connected in sequence to two new blocks: an Inport block and an Outport block. Inport and Outport blocks correspond to the input and output ports on the subsystem. Creating the subsystem from a selection that includes a named signal adds the name of the signal to the corresponding Inport or Outport block.
Click the Up to Parent button to return to the top level of the model.
The figure shows the model after you create the subsystem and name it.