Matlab® provides very useful transfer function commands to manipulate the transfer functions in required conditions. One of these commands is the ‘ss2tf()’ command. You can find the transfer function of a system from the state-space form of a system with the ‘ss2tf()’ command in Matlab®.

Here, we explain how to use the ‘ss2tf()’ command in Matlab® with a very basic example. You can try the example below in your Matlab® software.

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!

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

## How To Use The ‘ss2tf()’ Command In Matlab®?

Consider about a situation that we need to calculate the transfer function of the state-space model below;

[x1; x2] = [0 1; -25 0-4]*[x1(t); x2(t)] + [1 1; 0 1]*[u1(t);u2(t)];

[y1(t);y2(t)] = [1 0; 0 1][x1(t), x2(t)] + [0 0; 0 0]*[u1(t);u2(t)];

As you understand above, there are two inputs and two outputs of the system. This means that there are 4 transfer functions of this system. The problem can be solved with the code below in the Matlab® command window;

```
>> x = [0 1;-25 4];
y = [1 1; 0 1];
z = [1 0; 0 1];
t = [0 0 ;0 0];
[nom1, denum2] = ss2tf(x, y, z, t,1)
[nom2, denum2] = ss2tf(x, y, z, t,2)
nom1 =
0 1 -4
%first output first TF nominator
0 0 -25
%first output second TF nominator
denum2 =
1.0000 -4.0000 25.0000
%common denumerator of the TFs of first output
nom2 =
0 1.0000 -3.0000
%second output first TF nominator
0 1.0000 -25.0000
%second output first TF nominator
denum2 =
1.0000 -4.0000 25.0000
%common denumerator of the TFs of second output
>>
```

First of all, we need to define all the matrices inside the state-space model like above. All of these matrices are defined with ‘x’, ‘y’, ‘z’, and ‘t’ variables respectively.

To find all the 4 transfer functions, we used the ‘ss2tf()’ code two times. The first one gives the transfer functions of the first input. You can see the numerators and denominators of all the transfer functions of the first input.

The same thing is valid for the second output. Four transfer functions are;

TF1 = (s+4)/(s^2 + 4s + 25);

TF2 = 25/(s^2 +4s +25);

TF3 = (s+5)/(s^2 + 4s +25);

TF4 = 25/(s^2 + 4s + 25);

## Conclusion

As you see above, it is very simple to find the transfer functions of state-space forms in Matlab® with the ‘ss2tf()’ command.

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

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

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

Your precious feedbacks are very important to us.