123mylist.com

Matlab Program to plot Bode and Root Locus plot for the given transfer function

Matlab Program to plot Bode and Root Locus plot for the given transfer function.

In the initial basic course of Control systems in Engineering, you might be taught how to draw bode plot and root locus plot on the semi-log and general purpose graph sheets respectively. Well this can also done in MATLAB using a 1 line command.

In this post I want to tell how to draw bode and root locus graph in MATLAB which consumes fractions of seconds compared to the huge amount of time we spend on drawing those manually during written exams.

So suppose we have the transfer function as

s + 12
-------------
2 s^2 + s + 4

Then the Matlab program for the bode plot will be as follows:

`clcclear allnum=[1, 12];den=[2, 1, 4];system=tf(num,den)bode(system)`

 MATLAB screenshot of the bode plot for variation of both magnitude and phase with respect to Frequency

In this program the ‘bode(system)’ command automatically displays the bode graph for the system whose numerators and denominators have been defined in the 3rd and 4th lines.

MATLAB program to create transfer functions [Control Systems]

Secondly if you want to create root locus, then you may use the following command instead of bode() command

rlocus(system)

This will create the root locus of the given transfer functions.