# Matlab program to create transfer functions [Control Systems Lab]

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 ‘

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:

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

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

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

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:**- ‘clc’ and ‘clear all’ are used to clean up the command window and variables respectively.
- 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].
- Then in similar manner we assigned the values of ‘d’ corresponding to the values of ‘n’.
- 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.

Thanks a lot. Seems simple enough :)

ReplyDeletethankx

ReplyDeletehow toconnect thyristors in mat lab?please send it fast and explain clearly

ReplyDeletehow to connect thyristors in mat lab?

ReplyDeleteyou can do it using simulink. It is present in Simpowersystems blockset.

DeleteFor more detailed explanations, you can consider visiting the matlab/simulink tutorial here http://www.mathworks.in/help/toolbox/physmod/powersys/ref/thyristor.html

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

ReplyDeleteSomeone help me creative gershgorin bands for a system I have

ReplyDeletehow can I download center and radio functions