This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Convert transfer function filter parameters to state-space form


[A,B,C,D] = tf2ss(b,a)


tf2ss converts the parameters of a transfer function representation of a given system to those of an equivalent state-space representation.

[A,B,C,D] = tf2ss(b,a) returns the A, B, C, and D matrices of a state space representation for the single-input transfer function


in controller canonical form


The input vector a contains the denominator coefficients in descending powers of s. The rows of the matrix b contain the vectors of numerator coefficients (each row corresponds to an output). In the discrete-time case, you must supply b and a to correspond to the numerator and denominator polynomials with coefficients in descending powers of z.

For discrete-time systems you must make b have the same number of columns as the length of a. You can do this by padding each numerator represented in b (and possibly the denominator represented in the vector a) with trailing zeros. You can use the function eqtflength to accomplish this if b and a are vectors of unequal lengths.

The tf2ss function is part of the standard MATLAB® language.


There is disagreement in the literature on naming conventions for the canonical forms. It is easy, however, to generate similarity transformations that convert these results to other forms.


collapse all

Consider the system described by the transfer function

Convert it to state-space form using tf2ss.

b = [0 2 3; 1 2 1];
a = [1 0.4 1];
[A,B,C,D] = tf2ss(b,a)
A = 

   -0.4000   -1.0000
    1.0000         0

B = 


C = 

    2.0000    3.0000
    1.6000         0

D = 


A one-dimensional discrete-time oscillating system consists of a unit mass, , attached to a wall by a spring of unit elastic constant. A sensor samples the acceleration, , of the mass at Hz.

Generate 50 time samples. Define the sampling interval .

Fs = 5;
dt = 1/Fs;
N = 50;
t = dt*(0:N-1);
u = [1 zeros(1,N-1)];

The transfer function of the system has an analytic expression:

The system is excited with a unit impulse in the positive direction. Compute the time evolution of the system using the transfer function. Plot the response.

bf = [1 -(1+cos(dt)) cos(dt)];
af = [1 -2*cos(dt) 1];
yf = filter(bf,af,u);


Find the state-space representation of the system. Compute the time evolution starting from an all-zero initial state. Compare it to the transfer-function prediction.

[A,B,C,D] = tf2ss(bf,af);

x = [0;0];
for k = 1:N
    y(k) = C*x + D*u(k);
    x = A*x + B*u(k);

hold on
hold off

See Also

| | | | |

Introduced before R2006a

Was this topic helpful?