You can add blocks to a signal, remove blocks from models, and redraw connections. To modify this model, add a bias to the input to both branches of your model. Also, replace one of the scopes with a different sink. Add more blocks to the subsystem and another output.
Add a Bias block to the model and set the Bias
parameter to 2
.
Drag the block onto the signal line after the Sine Wave block but before the branch. If you need to make room for the block, drag the Sine Wave block to the left or move the end of the branch by dragging it to the right.
When you drag the block onto the signal line, the block connects to the signal line at both ends. Release the block when you are satisfied with the position.
Remove the top Scope block. If you want to disconnect it from the model, but do not want to delete it, press and hold Shift and drag the block. Cut or delete it using Ctrl-X or the Delete key. The broken connection appears as a red dotted line.
Tip
When you delete a block that has one input and one output, a prompt appears between the broken connection lines. Click the prompt to connect the signals.
Add a To Workspace block to the model at the end of the broken connection. The To Workspace block outputs the results to a variable in the MATLAB® workspace.
Add a Sine Wave block to the model and set the amplitude to
5
. Place it to the left of the subsystem.
Add another input to the subsystem. Drag a line from the new Sine Wave block to the left side of the subsystem. A new port, In2, appears on the subsystem.
For certain blocks, dragging a line to it adds an input port or output port. For example, a port appears on a subsystem when you connect a line to it. Other blocks that add ports include the Bus Creator, Scope, and Add, Sum, and Product blocks.
Add an output to the subsystem. Add another To Workspace block to the model and place it to the right of the subsystem. Drag a line from its input port to the right side of the subsystem. A new port, Out2, appears on the subsystem.
Open the subsystem and rename the Out2 block Workspace. Add a Manual Switch block to the subsystem. Resize it and connect it as shown. Branch the signal after the Gain block to direct the output to the To Workspace block.
Then, return to the top level of the model. The figure shows the current model.
Simulate the model.
The simout
and simout1
variables
appear in the MATLAB workspace. Double-click each variable to explore the results.
If you want to use the second sine wave as input to the subsystem algorithm, open the subsystem and double-click the switch. The input changes to In2. Simulate again.
Tip
To toggle between simulating the model with and without the effects of the Bias block, right-click the Bias block and select Comment Through. The block stays in the model but does not affect the operation. Right-click the Bias block and select Uncomment to enable the block. The Comment Out command comments out the block’s output signal, so signal data does not pass through. Try each of these commands to better understand their effects.