# Step Response Of A Transfer Function In MatLab

In the control system design, if the transfer function is known, some of the test inputs can be applied to see both the transient response and steady-state response of the system. Step input is one of these inputs that applied to the transfer function.

If you are interested to learn Matlab® at an engineering level, click on the given link or the ‘Shop Now’ button to check the recommended book by Mechanicalland, from Amazon!

Matlab® provides a very useful command called as ‘step()’ command. You can use the ‘step()’ command to test a transfer function of a control system. Here we show how to use the ‘step()’ command to do it.

## How To Use The ‘step()’ Command In MatLab®?

For example, we want to see the response of the transfer function;

TF = 25/(s^2 + 4s + 25)

To do it, you just need to type the code like this in Matlab® command window;

```
>> num = [0 0 25]; denom = [1 4 25];
step(num,denom)
>>
```

In this code, we just created two vectors that include the coefficients of the numerator and denominator of the transfer function, which are ‘num’ and ‘denom’ vectors respectively. The output is;

The ‘step()’ command automatically creates a plot that shows the response of the system to the step function. If you right-click on the graph, you can look at the peak response, settling time, rise time, and steady-state response of the system, from the ‘Characteristics’ menu.

You can also plot the response of a system to step input, by defining a time range. Check the code below.

```
>> num = [0 0 25]; denom = [1 4 25];
t=0:0.1:10;
step(num,denom,t)
>>
```

This is the same transfer function in which there is a slight difference. We defined a time vector ‘t’ and we added this inside the parentheses of the ‘step()’ command. It will give the response graph between this time interval like this;

As you see above, if you do not assign any variables to the ‘step()’ command, it will show the graph automatically. But if you assign variables, you can see the response of the system as the list in Command Window, corresponding to the assigned time interval. Check the code below again;

```
>> num = [0 0 25]; denom = [1 4 25];
t=0:0.1:10;
[a,b]=step(num,denom,t)
a =
0
0.1077
0.3599
0.6582
0.9271
1.1221
1.2281
1.2532
1.2189
1.1517
1.0761
1.0100
0.9637
0.9400
0.9362
0.9465
0.9643
0.9833
0.9995
1.0104
1.0156
1.0160
1.0130
1.0084
1.0036
0.9996
0.9971
0.9959
0.9960
0.9969
0.9981
0.9993
1.0002
1.0008
1.0010
1.0010
1.0008
1.0004
1.0001
0.9999
0.9998
0.9997
0.9998
0.9998
0.9999
1.0000
1.0000
1.0001
1.0001
1.0001
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
b =
[]
>>
```

## Conclusion

As you see above, the use of the ‘step()’ command is very simple to see the response of a control system to step input.

Do not forget to leave your comments and questions below about the use of the ‘step()’ command in Matlab® below.

If you want further coding examples about the ‘step()’ command in Matlab®, inform us in the comments.

YOU CAN LEARN MatLab® IN MECHANICAL BASE; Click And Start To Learn MatLab®!

This article is prepared for completely educative and informative purposes. Images used courtesy of Matlab®

Your precious feedbacks are very important to us.