Dear Readers, I hope You are practicing the matlab tutorial written by me regularly. Share your queries and problems which you are facing during your MATLAB practice. It will be my pleasure to solve your basic MATLAB problems.

Today in Post-09 of Module-II, we will learn to create simulation model for Closed loop control. Along with that we will also learn how to merge two waveform on single display. First of all open simulink library browser and create new simulink file. Drag some block i.e. Sine wave, Sum, Gain (Two Block), Mux and Scope from simulink browser into new simulink file and connect this block as shown in figure-1.

In this simulation sine wave is the input given to the system of two Gain and one Sum block. To analyze system input and system output on a single axis, we have used Mux, which merge two signal in single axis. Mux output is fed to scope for analysis. The parameters of all the block has been set through their selection panel, which is being discuss below:

1) Sine Wave: Through selection panel of sine wave block, you can generate a sine wave of your choice. I have selected a sine wave of amplitude 20, frequency 5 Hz and Phase angle 90 degree.
Figure.2 - Selection Panel for Sine Block

The sampling time of the simulation is taken as 10 micro second.

2) Mux: : Through selection panel of mux block, you can merge number of signal into single axis. In this simulation I have merged two signal, hence number of inputs is 2.

Through display option tab you can change the shape of mux block.

3) Gain: In this system, we have used two gain block. First Gain block is used in forward path and second Gain1 block is used in feedback path. Through selection panel of both gain block, you can create a system of your choice. I have selected a system with forward gain and feedback gain 2.

The sampling time of the simulation is taken as 10 micro second.

4) Sum: Sum block is used to add two input. While you can perform other functions like subtract, multiply or divide through this block by changing list of signs as shown in figure-5.

5) Scope: The scope block is used to display the waveform of the system. Now to analyze the closed loop control system, Run the simulation by clicking on Start Simulation button. Then click on the scope block which will show the input and output of the system as shown in figure-6.
Figure.6 - Output of the Closed Loop Control.

The waveform shown with yellow color is input to the closed loop control system while waveform shown with purple color is output of the closed loop control system. It is clear from the figure 6 that the magnitude of Output is lesser then magnitude of the input. We can vary output of the system by varying its gain.

#### Video Tutorial :

Closed Loop Control Using MATLAB Simulink.