Solving RLC circuit using MATLAB Simulink : tutorial 5

In this tutorial, I will explain you the working of RC and RL circuit. First the brief and concise introduction of capacitive and inductive circuits is provided explaining the effect of introducing each of them in a resistive circuit. After that the concept provided in introduction part is implemented with the help of MATLAB’s Simulink, and the theoretical results are compared with the virtual results of the block diagram provided by Simulink which comes out to be same. At the end of the tutorial you are provided with an exercise to do it by yourself, and in the next tutorials I will assume that you have done those exercises and I will not explain the concept regarding them.

How to solve RLC Circuits using Simulink 

Lets’ now move towards the programming part. Up till now we have been using library browser to place any block in simulink for simulation purpose.  But that’s quite hectic to search for each block in the library browser in each section. We had another option to search for the block in the library browser, but that too was too much time consuming. Another and so far best option to place a block is to search for it in the simulink window. Just stay in the simulink window and press the search button from your keyboard. This will show a small search icon on the simulink window as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 1: Searching

  • Click on that search sign and type the block name or a relevant name you want to search and a drop down menu will appear with a list of similar blocks showing, which are available in Simulink’s library browser. For instance, in our case we want to place an AC voltage source which will be used as an input source for the RLC circuit. Type ac voltage source in the search bar and a drop down with multiple items will appear as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 2: AC source search

  • Click on the first item from the list and it will be placed on the simulink window as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 3: AC voltage source

  • Again click on the search button and then click on the search icon. In the search bar thus appeared write rlc and a number of rlc branches will appear as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 4: RLC branch search

  • Select the series RLC branch as I have selected in the above figure and double click on it to place the component on the Simulink window. The series RLC branch when placed is shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 5: Series RLC branch

  • This branch can be converted to any of the three components or any combinations of the three components i.e. R, L, C, RL, RC, LC etc. In our case we need three components i.e. R, L, and C so we will place three such Series RLC branch on the simulink window as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 6: 3 RLC branches

  • Now the question here is, how to convert these branches to individual components? Double click on the first RLC branch and a parameters window will appear. There will be a menu to select which combination of all the three components you want to place on your simulink window. From that menu select R to convert the series RLC branch to a resistor branch as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 7: Resistor branch

  • Do the same with the second branch but this time select the inductor option from the menu as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 8: Inductor branch

  • Do the same with the third branch but this time select the capacitor option from the menu as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 9: Capacitor branch

  • The three branches will then be converted to three different components i.e. resistor, capacitor and inductor as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 10: Changed branches

  • Now we want to place a voltage measurement device which will help us to measure the voltage at each node of the circuit. In the search bar type Voltage measurement as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 11: Voltage measurement search

  • Connect the voltage measurement block at the ends of the AC input source and connect all the branches to complete the loop as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 12: Connected circuit

  • Now in the search bar type ground and a number of grounds will appear as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 13: Ground search

  • Connect the ground at the negative side of the AC voltage source, as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 14: Connected ground

  • Place three other voltage sources from the same search bar and connect each of them across each of the components connected previously i.e. resistor, inductor and capacitor as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 15: Voltage measurement

  • Now from the library browser’s commonly used blocks section select a scope as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 16: Scope placement

  • Place four such scopes and connect each of them with the voltage measurement devices as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 17: Connected scopes

  • By doing so we will not be able to see all the waveforms simultaneously. However, there is another option. We can give all the inputs to same scope by adjusting the properties of the scope. Double click on the scope and from the window thus obtained select the configuration properties button as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 18: Configuration properties

  • From the properties change the number of input ports from 1 to 4 as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 19: Input ports

  • Connect the nodes of each of the voltage measuring devices to the inputs of the scope as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 20: Multiple input scope

  • This block diagram will not run however, because the power blocks are not initialized. We need to place a powergui block in the diagram to make it error free. Search powergui in the search bar as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 21: Powergui search

  • Place the block anywhere in the block diagram as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 22: Powergui

  • Run the block diagram and double click on the scope to see the output of the waveforms as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 23: Output

  • Click on the view button and check the legends option as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 24: Legends

  • To display all the four graphs separately click on the arrow at the side of settings button and select layout as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 25: Layout

  • Select four blocks from the layout window as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 26: Layout blocks

  • This will show all the graphs on separate sections. Scale all the graphs according to the need as shown in the figure below,Solving RLC circuit using MATLAB Simulink : tutorial 5

Figure 27: Output graphs

Notice the amplitude of all the waveforms which are in accordance with the theory.

Exercise:

  • Try to work with RL and RC circuit. Use the similar fashion as discussed here except using either inductor or capacitor in place of both.

Leave a Comment