MATLAB Simulink – Logic Gates Model ”; Previous Next In this chapter, let us understand how to build a model that demonstrates the logic gates. For example, gates like OR, AND, XOR etc. Open the Simulink and open a blank model as shown below − Click on blank model and select the Simulink library as shown below − Let us select the block that we want to build a OR gate. We need two constant blocks to act as inputs, a logic operator block and a display block. The constant and logic operator block will get from commonly used blocks library. Select the blocks and drag in your model or just type the name of the block in your model and select the block as shown below − Select the constant block, we need two constant block, a logical operator and a constant. The blocks will look as shown below − Right click on the logic operator block and it will display the block parameters as shown below − With logical operator you can use AND, OR, NAND, NOR, XOR, NXOR and NOT gates. Right now we are going to select the OR gate. Now connect the lines and the model will be as shown below − For an OR gate if the inputs are 1,1 the output will be 1. If the inputs are 0,0 the output will be 0. Right now, the constant has values 1,1. Let us run the model to see the output as shown below − We can see in the display block the output shown is 1. Let us now change the constant value to 0. Right click on constant block and change the value as shown below − After changing the values of constant to 0, the output will become 0 when you run the model. The output is as shown below − Let us now change the constant values to 0,1 and see the output − With values as 1,0, the display will be as follows − Similarly, you can design the AND and other gates. Print Page Previous Next Advertisements ”;
Category: matlab Simulink
MATLAB Simulink – Lines
MATLAB Simulink – Lines ”; Previous Next In the previous chapter, we learnt about the different types of blocks which are available with Simulink library. In this chapter, we are going to understand about lines. Lines are used to connect the blocks with an arrow. Each block will have its own input and output connector. The communication between the blocks will take place with the help of lines. Let us understand the same with an example. Select a blank model from Simulink page as shown below − It will open a blank model workspace as shown below − Click on Simulink Library browser to drag some blocks in the model workspace. Consider that in the model, we want to add two given numbers. So let us pick the Add block, the display block and the constant block. The constant block has one output connector, the Add block has two input connectors and the display block has one input connector respectively. You can drag the link from one output to another input as shown below. Here, we have two constants with values 10 and 20. They are connected to the add block with lines. The add block is connected to display with a line. When the lines are connected, the display is as follows − Now click on Run to see the result in the display block. It will add 10 + 20 to give the result as 30 in the display block. Print Page Previous Next Advertisements ”;