# Conversion Of Transfer Functions To State-Space Form In MatLab®

This conversion can be made with the ‘tf2ss()’ command in Matlab®. If a transfer function is obtained in a polynomial state, this command creates the state-space model of that transfer function of a control system. Here we explain how to obtain state-space models of transfer functions in Matlab® with the ‘tf2ss()’ command, with a very basic coding example. You can try this code example in your Matlab® software.

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

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

``````>> nom = 10;
denom = [1 4 3];
[x, y, z, t] = tf2ss(nom,denom)

x =

-4    -3
1     0

y =

1
0

z =

0    10

t =

0

>> ``````

The use of the ‘tf2ss()’ command is very simple in Matlab®. First of all, you need to create the proper vectors that include the coefficients of the nominator and denominator of the input transfer function. In this example, these vectors are ‘nom’ and ‘denom’. Then you need to write these vectors inside the parentheses of the ‘tf2ss()’ command.

After that, you need to assign the ‘tf2ss()’ command to four result variables. These variables are ‘x’, ‘y’, ‘z’, and ‘t’ in this example. Execute the code and see the result in the Matlab® command window.

According to this example, the input transfer function is;

TF = 10/(s^2 + 4s +3)

The output state-state model of this transfer function is;

[X1;X2] = [-4 -3; 1 0]*[x1(t) x2(t)] + [1;0]*u(t);

y(t) = [0 10]*[x1(t); x2(t)];

If you compare the results with the output space-state model, you will understand which result variable shows what.

## Conclusion

The use of the ‘tf2ss()’ command in Matlab® to obtain state-space results of the transfer function in polynomial form.

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

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