Matlab program to create transfer functions [Control System Lab].

In this post I am going to describe how to create a Matlab program to create a transfer function. This program is specifically meant for the Matlab beginners in control systems laboratory.

Well you might be aware of what is the full name of the Matlab software, for those who don’t know, it is ‘Matrix Laboratory’. Before writing the simple program for creating transfer function in Matlab, I assume, you have started Matlab and have created a new ‘.m’ file from the File Menu > New > M-File.

Now save the new M-file with any of the file name except using any predefined mathematical keywords like tf, sine, cos, square etc.

In this tutorial we shall be creating a transfer function: Transfer Function

So to create the transfer function shown above, you can simply copy and paste the Matlab code given below:

`clc;`
`clear all;`
`n = [0 1 4];`
`d = [2 0 5];`
`sys = tf(n,d)`

Now after pasting this code, save it and then run. Now the command window will display the transfer function.

Description of this program:
1. ‘clc’ and ‘clear all’ are used to clean up the command window and variables respectively.
2. Then we shall define the numerator as variable ‘n’ and assigned its value as the coefficient of each term in proper order starting from the highest degree. Here highest degree of ‘s’ is 2, so starting from the coefficient of square of s, we have 0 as coefficient of ‘s^2’ and 1 as the coefficient of ‘s’ and 4 as the third term. So we assigned n in a matrix form as [0 1 4].
3. Then in similar manner we assigned the values of ‘d’ corresponding to the values of ‘n’.
4. The statement ‘sys= tf(x,y)’ is the syntax for the transfer function. So we stored the transfer function in the variable ‘sys’, where ‘x’ is numerator and ‘y’ is denominator.

If you have any questions, you can drop in your comments and I will answer you as soon as possible.

1. Thanks a lot. Seems simple enough :)

2. thankx

3. how toconnect thyristors in mat lab?please send it fast and explain clearly

4. how to connect thyristors in mat lab?

1. you can do it using simulink. It is present in Simpowersystems blockset.
For more detailed explanations, you can consider visiting the matlab/simulink tutorial here http://www.mathworks.in/help/toolbox/physmod/powersys/ref/thyristor.html

5. i tried this but resut showing 'not enough input argument'

6. Someone help me creative gershgorin bands for a system I have