# Transfer Functions of Different Systems using MATLAB

#### Introduction

In control systems, we deal with different components that involve different kinds of physical quantities. Ranging from a mechanical valve to an RF transmitter, there is a dire need to interface and control a variation of objects accurately in order to successfully implement the control algorithm. To make representations easier, we use Laplace Transforms to represent the various signals and systems. This helps us in representing these quantities in a similar form, thus making mathematical analysis easy.

A transfer function is defined as the ratio of Laplace Transform of output of a system to the Laplace Transform of its input assuming all initial conditions to be zero.

In order to analyse a system, we must be able to form its transfer function and then manipulate it to understand various parameters of the system. In MATLAB, there are a few predefined functions that can create the transfer function of our choice. These functions are discussed in detail in the following functions.

#### Using MATLAB to Create Transfer Function

MATLAB provides an easy and quick way for creating transfer functions and working with them. There are a few functions that create an object of the entered transfer function. This helps in analysing and manipulating the transfer function. It also allows the user to use complex algorithms like Root Locus Plot that can help understand the stability criterions and other important parameters.

In MATLAB, we can compute the transfer function of a SISO system using different functions.

FUNCTION:         tf

A general SISO transfer function can be represented as

G(s)=   N(s)/D(s)

where N(s) and D(s) are polynomials in s.

We can use tf function to create a transfer function of this type

Syntax: sys=tf (numerator, denominator)

Here, numerator and denominator are entered in the form of numeric arrays that comprises of the coefficients of s in the decreasing order of its power.

This function returns a transfer function model object as the output.

Code and output shows how to create a simple second order transfer function

G(s)=

We can also define the frequency domain variable ‘s’ and then form a rational or complex type of transfer function. The following image shows the code for this method.

Not limited to single inputs, we can also create transfer functions for MIMO systems in MATLAB.

To create MIMO transfer functions, we can use one of the following approaches:

• Concatenate SISO tf models.
• Use the tf command with cell array arguments.

The example below demonstrates how to create a MIMO model.

We can also incorporate other features like introduction of time delay, augmentation, noise, dynamics etc.

The tf functions gives as output a ‘tf’ type object. We can directly manipulate these objects as shown below.

#### Analysing Simple Transfer Functions

Once we are done with creating transfer functions and storing them, the next important thing it to study their response. In most systems, we focus on analysing the step response or impulse response of the system. Analysing the step (impulse) response involves analysing the behaviour of the system when it is given a unit step (impulse) input. In MATLAB, we can use special functions like step and impulse to directly find a system’s response for these standard input signals.

An example is shown below where we find the step response and impulse response of a second order system and plot it.

Analysing system response for non-standard input signal

After analysing the step and impulse response, we should also be able to find the response of the system for random signals. The general procedure for calculating the response is to first find the Laplace transform of input signal; Multiply it with the system transfer function; Find the inverse Laplace transform of this product to obtain the time response; Plot it against time and analyse.

In MATLAB, we can simply use the ‘lsim’ function to find and plot the response of a system for any input signal.

Syntax: lsim (sys, u, t)

Here u is the non-standard input signal in time domain and t specifies the time variable.

The following example shows the implementation of this function.

In the above figure, we have calculated the response of the system to a ramp input represented by the function u(t)=t. The response is calculated for values of t in the range entered, in this case, 0<t<5 with steps of 0.05.

The figure window gives the system response (in blue) along with the input signal plot (in grey).

#### Conclusion

The above examples show how to create transfer functions in MATLAB using the function ‘tf ‘. This function provides a very easy and efficient way of forming transfer functions and manipulating them. Moreover, once we create the ‘ tf object’ we can use other functions like stepplot, impulse , lsim to analyse the response of system and know more about the system parameters.

##### Shivani Singh

A final year engineering student from Bharati Vidyapeeth's College of Engineering, New Delhi with great zeal and passion for writing and technology. I have great love for food, nature, reading and am a true Delhiite at heart !

### Recommended Posts

##### Test Post

17 Feb 2018 - Tutorial

##### Counters using conditionally executed subsystems | Simulink Tutorial

16 Feb 2018 - Simulink, Tutorial

##### Regulating drum boiler pressure

16 Feb 2018 - Simulink, Tutorial