Simulating Electronic Circuits using Simulink

Simulating Electronic Circuits using Simulink

Hello everyone, in this blog we will see what is MATLAB, Why should we use MATLAB, and how can we simulate electrical circuits in MATLAB.

What is MATLAB?

MATLAB stands for Matrix Laboratory. It is used for numerical computation and visualization. It has many built-in functions which can be used to analyze and design different systems. We can use MATLAB both in online and offline mode.

Why should we use MATLAB?

MATLAB can be used to visualize functions as we can plot 2-d and 3-d graphs easily with the help of MATLAB. It also has various types of toolboxes, (a toolbox is a collection of functions written for specific applications).

Our main task is to simulate different electrical circuits using MATLAB. But why should we use Matlab for that? Due to covid-19, many courses are conducted in online mode, so students can’t get an experience of how actual hardware circuits work. But with the help of MATLAB, we can make circuits using various components available, and run simulations to get a sense of how the circuit is going to behave.

The reason we chose MATLAB to simulate circuits is that it gives many extra features which other simulators do not give.  For example, we can use an HDL simulator to generate Verilog code, we can co-simulate Verilog code and Simulink file. Also, we can generate a Simulink file from Verilog code.

Also Read - IR Sensor Interfacing with Arduino

How we can make an electrical circuit in MATLAB using Simulink:

  1. There are two different ways to open Simulink, 1st you can type “Simulink” in the command window or you can directly click on the Simulink icon.
Electronic circuit simulation
  1. Once you open Simulink you can select a blank model to create a new circuit.
  2. To select a component you should first download the suitable library for the component.
  3. Then to select any component you can simply double click and type its name or you can go to the library and then select the component.
  4. To make a connection between components you can simply left-click hold at the starting point and drag till the endpoint.
  5. Now to begin the simulation of the circuit you can set stop time as per your application, and click on the run button.
Best circuit simulation software for electronics engineers

Now if you need to see some waveforms, you can use the scope for that. On the scope, we can connect multiple signals. You can find the scope by double-clicking and typing “scope” or by selecting it from MATLAB. After selecting scope you need to connect the scope with the different signals that you want to see. After all the connections you can run the simulation, and then by double-clicking on the scope you can see different waveforms in it. Now if there are many waveforms you can change the layout by following the steps given below:

  1. Click on the down arrow next to the setting.
  2. Select the layout option in it.
  3. Then you can select any layout according to your choice.
  4. Also, you can zoom in and zoom out in it.

Now if you are working in a team, and you need to send this file to someone who has an older version of MATLAB, then you need to export the slx file to the previous version. So let’s see how we can export file to a previous version:

  1. Open the file in the new version.
  2. Click on the down arrow next to save.
  3. You will see an option for “Previous Version” select that.
  4. Now in the previous version dialogue box select the required version from the save as type list.
Simulating Electronic Circuits

Now, for example, let’s see one simple series RLC circuit:

Electronic Circuits Simulation using Simulink

Here we are using current sensing device ammeter and voltage sensing device voltmeter to detect current and voltmeter, and to see the result we are using the scope. Now after the simulation is complete, if we double click on any scope we can see the waveform on it. For example, the waveform on the scope which shows current and voltage across the capacitor is:

Simulink

This blog has been submitted by KRSSG, IIT-Kharagpur under the Robocraze Club Outreach Program.

Author: Devendra Sanklecha

Components and Supplies

    You may also like to read

    Frequently Asked Questions

    Back to blog

    Leave a comment

    Please note, comments need to be approved before they are published.

    Components and Supplies

      You may also like to read