# Transforming between Mathematical Representations of Systems, Overview

This document is a compilation of all of the pages relating to the transformation between different mathematical representations of systems.  It is useful for printing.

Contents

 Transformation Description CDE → 1DE Coupled Differential Equation to Single Differential Equation 1DE ↔ TF Single Differential Equation to/from Transfer Function 1DE ↔ SS Single Differential Equation to/from State Space 1DE ↔ PZ Single Differential Equation to/from Pole Zero 1DE ↔ SFG Single Differential Equation to/from Signal Flow Graph/Block Diagram TF ↔ SS Transfer Function to/from State Space TF ↔ PZ Transfer Function to/from State Space TF ↔ SFG Transfer Function to/from State Space SS ↔ SS State Space to/from State Space SS ↔ PZ State Space to/from Pole Zero SS ↔ SFG State Space to/from Signal Flow Graph/Block Diagram PZ ↔ SFG Pole Zero to/from Signal Flow Graph/Block Diagram

# Transformation: Coupled Diff Eq → Single Diff Eq

Methods for transforming from coupled differential equations to a single nth order differential equation were discussed on the page "System Representation by Differential Equations," example 3 and example 4.   Another example is included below.  It shows how to start with a set of coupled differential equations and transform them into a single nth order differential equation.

##### Example: Deriving a single nth order differential equation from coupled equations

Consider the system shown with fa(t) as input and x(t) as output.  Find the differential equation relating x(t) to fa(t).

We can write free body equations for the system at x and at y.

 Freebody Diagram Equation

Take the Laplace Transform of both equations with zero initial conditions (so derivatives in time are replaced by multiplications by "s" in the Laplace domain).

Now solve the second equation for Y(s) and substitute into the first equation and clear the fractions (so there are only positive powers of s).

Convert back to differential equation (replacing "s" in Laplace by a derivative in time).

##### Matlab Solution

Matlab code, html

Erik Cheever       Department of Engineering         Swarthmore College

# Transformation: Single Diff Eq ↔ Transfer Function

Contents

## Single Differential Equation to Transfer Function

If a system is represented by a single nth order differential equation, it is easy to represent it in transfer function form.  Starting with a third order differential equation with x(t) as input and y(t) as output.

To find the transfer function, first take the Laplace Transform of the differential equation (with zero initial conditions).  Recall that differentiation in the time domain is equivalent to multiplication by "s" in the Laplace domain.

The transfer function is then the ratio of output to input and is often called H(s).

Note: This notation takes increasing subscripts for the an and bn coefficients as the power of s (or order of derivative decreases) while some references use decreasing subscripts with decreasing power.  This notation was chosen here in part because it is consistent with MatLab's use.

For the general case of an nth order differential equation with m derivatives of the input (superscripted numbers in parentheses indicate the order of the derivative):

This can be written in even more compact notation:

## Transfer Function to Single Differential Equation

Going from a transfer function to a single nth order differential equation is equally straightforward; the procedure is simply reversed.  Starting with a third order transfer function with x(t) as input and y(t) as output.

To find the transfer function, first write an equation for X(s) and Y(s), and then take the inverse Laplace Transform.  Recall that multiplication by "s" in the Laplace domain is equivalent to differentiation in the time domain.

For the general case of an nth order transfer function:

This can be written in even more compact notation:

## Example: Transforming Between Single Differential Equation and Transfer Function

##### Example: Single Differential Equation to Transfer Function

Consider the system shown with fa(t) as input and x(t) as output.

Find the transfer function relating x(t) to fa(t).

Solution: Take the Laplace Transform of both equations with zero initial conditions (so derivatives in time are replaced by multiplications by "s" in the Laplace domain).

Now solve for the ration of X(s) to Fa(s) (i.e, the ration of output to input).  This is the transfer function.

##### Example: Transfer Function to Single Differential Equation

Find the differential equation that represents the system with transfer function:

Solution: Separate the equation so that the output terms, X(s), are on the left and the input terms, Fa(s), are on the right.  Make sure there are only positive powers of s.

Now take the inverse Laplace Transform (so multiplications by "s" in the Laplace domain are replaced by derivatives in time).

Erik Cheever       Department of Engineering         Swarthmore College

# Transformation: Differential Equation ↔ State Space

Given a system differential equation it is possible to derive a state space model directly, but it is more convenient to go first derive the transfer function, and then go from the transfer function to the state space model.

##### Example: Diff Eq → State Space

Find a state space model for the system described by the differential equation:

Step 1: Find the transfer function using the methods described here (1DE ↔ TF)

Step 2: Find a state space representation using the methods described here (TF ↔ SS).  In this case we are using a CCF form).

##### Example: State Space → Diff Eq

Repeat the previous example, but reverse the order (i.e., do step 2 (SS → TF) then step 1 (TF → SS)).

Erik Cheever       Department of Engineering         Swarthmore College

# Transformation: Differential Equation ↔ Pole-Zero

Given a system differential equation it is possible to derive a pole-zero model directly, but it is more convenient to go first derive the transfer function, and then go from the transfer function to the pole-zero model.

##### Example: Diff Eq → Pole-Zero

Find a pole-zero model for the system described by the differential equation:

Step 1: Find the transfer function using the methods described here (1DE ↔ TF)

Step 2: Find a pole-zero representation using the methods described here (TF ↔ PZ).  The pole-zero representation consists of:

• a constant term, k=3,
• zeros at s=-1 and s=-2, and
• polese at s=-1+j, s=-1-j and s=-3.
##### Example: Pole-Zero → Diff Eq

Repeat the previous example, but reverse the order (i.e., do step 2 (PZ → TF) then step 1 (TF → DE).

Erik Cheever       Department of Engineering         Swarthmore College

# Transformation: Differential Equation ↔ Signal Flow Graph

Given a system differential equation it is possible to derive a signal flow graph directly, but it is more convenient to go first derive the transfer function, and then go from the transfer function to the state space model, and then from the state space model to the signal flow graph.

##### Example: Diff Eq → Signal Flow Graph

Find a signal flow graph for the system described by the differential equation:

Step 1: Find the transfer function using the methods described here (1DE ↔ TF)

Step 2: Find a state space representation using the methods described here (TF ↔ SS).  In this case we are using a CCF form).

Step 3: Find a signal flow graph using the methods described here (TF ↔ SFG).

This example is not yet finished

##### Example: Signal Flow Graph→ Diff Eq

Repeat the previous example, but reverse the order (i.e., do step 3 (SFG → SS) then step 2 (SS → TF)then step 1 (TF → DE)).

Another option is to go directly from the Signal Flow Graph to the Transfer Function directly (using Mason's gain formula) and then go from the transfer function to the differential equation.

Erik Cheever       Department of Engineering         Swarthmore College

# Transformation: Transfer Function ↔ State Space

Contents

Two of the most powerful (and common) ways to represent systems are the transfer function form and the state space form.  This page describes how to transform a transfer function to a state space representation, and vice versa.  Converting from state space form to a transfer function is straightforward because the transfer function form is unique.  Converting from transfer function to state space is more involved, largely because there are many state space forms to describe a system.

## State Space to Transfer Function

Consider the state space system:

Now, take the Laplace Transform (with zero initial conditions since we are finding a transfer function):

We want to solve for the ratio of Y(s) to U(s), so we need so remove Q(s) from the output equation.  We start by solving the state equation for Q(s)

The matrix Φ(s) is called the state transition matrix.  Now we put this into the output equation

Now we can solve for the transfer function:

Note that although there are many state space representations of a given system, all of those representations will result in the same transfer function (i.e., the transfer function of a system is unique; the state space representation is not).

##### Example: State Space to Transfer Function

Find the transfer function of the system with state space representation

First find (sI-A) and the Φ=(sI-A)-1 (note: this calculation is not obvious.  Details are here).  Rules for inverting a 3x3 matrix are here.

Now we can find the transfer function

To make this task easier, MatLab has a command (ss2tf) for converting from state space to transfer function.

```>> % First define state space system
>> A=[0 1 0; 0 0 1; -3 -4 -2];
>> B=[0; 0; 1];
>> C=[5 1 0];
>> [n,d]=ss2tf(A,B,C,D)

n =
0         0    1.0000    5.0000
d =
1.0000    2.0000    4.0000    3.0000

>> mySys_tf=tf(n,d)
Transfer function:
s + 5
----------------------
s^3 + 2 s^2 + 4 s + 3```
##### Example: State Space to Transfer Function (Symbolic)

Find the transfer function of the system with state space representation

First find (sI-A) and the Φ=(sI-A)-1 (note: this calculation is not obvious.  Details are here).

Now we can find the transfer function

##### Key Concept: Transforming from State Space to Transfer Function

Given a state space representation of a system

the transfer function is give by

and the characteristic equation (i.e., the denominator of the transfer function) is

## Transfer Function to State Space

Recall that state space models of systems are not unique; a system has many state space representations.  Therefore we will develop a few methods for creating state space models of systems.

Before we look at procedures for converting from a transfer function to a state space model of a system, let's first examine going from a differential equation to state space.  We'll do this first with a simple system, then move to a more complex system that will demonstrate the usefulness of a standard technique.

First we start with an example demonstrating a simple way of converting from a single differential equation to state space, followed by a conversion from transfer function to state space.

##### Example: Differential Equation to State Space (simple)

Consider the differential equation with no derivatives on the right hand side.  We'll use a third order equation, thought it generalizes to nth order in the obvious way.

For such systems (no derivatives of the input) we can choose as our n state variables the variable y and its first n-1 derivatives (in this case the first two derivatives)

Taking the derivatives we can develop our state space model

Note: For an nth order system the matrices generalize in the obvious way (A has ones above the main diagonal and the differential equation constants for the last row, B is all zeros with b0 in the bottom row, C is zero except for the leftmost element which is one, and D is zero)

##### Repeat Starting from Transfer Function

Consider the transfer function with a constant numerator (note: this is the same system as in the preceding example).  We'll use a third order equation, thought it generalizes to nth order in the obvious way.

For such systems (no derivatives of the input) we can choose as our n state variables the variable y and its first n-1 derivatives (in this case the first two derivatives)

Taking the derivatives we can develop our state space model (which is exactly the same as when we started from the differential equation)

Note: For an nth order system the matrices generalize in the obvious way (A has ones above the main diagonal and the coefficients of the denominator polynomial for the last row, B is all zeros with b0 (the numerator coefficient) in the bottom row, C is zero except for the leftmost element which is one, and D is zero)

If we try this method on a slightly more complicated system, we find that it initially fails (though we can succeed with a little cleverness).

##### Example: Differential Equation to State Space (harder)

Consider the differential equation with a single derivative on the right hand side.

We can try the same method as before:

The method has failed because there is a derivative of the input on the right hand, and that is not allowed in a state space model.

Fortunately we can solve our problem by revising our choice of state variables.

Now when we take the derivatives we get:

The second and third equations are not correct, because ÿ is not one of the state variables.  However we can make use of the fact:

The second state variable equation then becomes

In the third state variable equation we have successfully removed the derivative of the input from the right side of the third equation, and we can get rid of the ÿ term using the same substitution we used for the second state variable.

The process described in the previous example can be generalized to systems with higher order input derivatives but unfortunately gets increasingly difficult as the order of the derivative increases.  When the order of derivatives is equal on both sides, the process becomes much more difficult (and the variable "D" is no longer equal to zero).  Clearly more straightforward techniques are necessary.  Two are outlined below, one generates a state space method known as the "controllable canonical form" and the other generates the "observable canonical form (the meaning of these terms derives from Control Theory but are not important to us).

### Controllable Canonical Form (CCF)

Probably the most straightforward method for converting from the transfer function of a system to a state space model is to generate a model in "controllable canonical form."  This term comes from Control Theory but its exact meaning is not important to us.  To see how this method of generating a state space model works, consider the third order differential transfer function:

We start by multiplying by Z(s)/Z(s) and then solving for Y(s) and U(s) in terms of Z(s).  We also convert back to a differential equation.

We can now choose z and its first two derivatives as our state variables

Now we just need to form the output

From these results we can easily form the state space model:

In this case, the order of the numerator of the transfer function was less than that of the denominator.  If they are equal, the process is somewhat more complex.  A result that works in all cases is given below; the details are here.  For a general nth order transfer function:

the controllable canonical state space model form is

##### Key Concept: Transfer function to State Space (CCF)

For a general nth order transfer function:

the controllable canonical state space model form is

### Observable Canonical Form (OCF)

Another commonly used state variable form is the "observable canonical form."  This term comes from Control Theory but its exact meaning is not important to us.  To understand how this method works consider a third order system with transfer function:

We can convert this to a differential equation and solve for the highest order derivative of y:

Now we integrate twice (the reason for this will be apparent soon), and collect terms according to order of the integral:

Choose the output as our first state variable

Looking at the right hand side of the differential equation we note that y=q1 and we call the two integral terms q2:

so

This is our first state variable equation.

Now let's examine q2 and its derivative:

Again we note that y=q1 and we call the integral terms q3:

so

This is our second state variable equation.

Now let's examine q3 and its derivative:

This is our third, and last, state variable equation.

Our state space model now becomes:

In this case, the order of the numerator of the transfer function was less than that of the denominator.  If they are equal, the process is somewhat more complex.  A result that works in all cases is given below; the details are here.  For a general nth order transfer function:

the observable canonical state space model form is

##### Key Concept: Transfer function to State Space (OCF)

For a general nth order transfer function:

the observable canonical state space model form is

### Other forms

There are many other forms that are possible.  For example MATLAB uses a variant of the controllability canonical form in its "ssdata" function.

Erik Cheever       Department of Engineering         Swarthmore College

## Transfer Function → State Space (order of numerator=order of denominator)

If the order of the numerator is equal to the order of the denominator, it becomes more difficult to convert from a system transfer function to a state space model.  This document shows how to do this for a 3rd order system.  The technique easily generalizes to higher order.

### Controllable Canonical Form (CCF)

Consider the third order differential transfer function:

We start by multiplying by Z(s)/Z(s) and then solving for Y(s) and U(s) in terms of Z(s).  We also convert back to a differential equation.

We can now choose z and its first two derivatives as our state variables

Now we just need to form the output

Unfortunately, the third derivative of z is not a state variable or an input, so this is not a valid output equation.  However, we can represent the term as a sum of state variables and outputs:

and

From these results we can easily form the state space model:

In this case, the order of the numerator of the transfer function was less than that of the denominator.  If they are equal, the process is somewhat more complex.  A result that works in all cases is given below; the details are here.

### Observable Canonical Form (OCF)

Consider the third order differential transfer function:

We can convert this to a differential equation and solve for the highest order derivative of y:

Now we integrate twice (the reason for this will be apparent soon), and collect terms according to order of the integral (this includes bringing the first derivative of u to the left hand side):

Without an justification we choose y-b0u as our first state variable

Looking at the right hand side of the differential equation we note that y=q1 and we call the two integral terms q2:

This isn't a valid state equation because it has "y" on the right side (recall that only state variables and inputs are allowed).  We can get rid of it by noting:

so

This is our first state variable equation.

Now let's examine q2 and its derivative:

Again we note that y=q1+b0u and we call the integral terms q3:

This is our second state variable equation.

Now let's examine q3 and its derivative:

This is our third, and last, state variable equation.

Our state space model now becomes:

Here is a good reference that does the same derivations from a different perspective: http://www.ece.rutgers.edu/~gajic/psfiles/canonicalforms.pdf

Erik Cheever       Department of Engineering         Swarthmore College

# Transformation: Transfer Function ↔ Pole Zero

The pole-zero and transfer function representations of a system are tightly linked. For example consider the transfer function:

If we rewrite this in a standard form such that the highest order term of the numerator and denominator are unity (the reason for this is explained below).

This is just a constant term (b0/a0) multiplied by a ratio of polynomials which can be factored.

In this equation the constant k=b0/a0.  The zi terms are the zeros of the transfer function; as s→zi the numerator polynomial goes to zero, so the transfer function also goes to zero.  The pi terms are the poles of the transfer function; as s→pi the denominator polynomial is zero, so the transfer function goes to infinity.

In the general case of a transfer function with an mth order numerator and an nth order denominator, the transfer function can be represented as:

The pole-zero representation consists of the poles (pi), the zeros (zi) and the gain term (k).

Note: now the step of pulling out the constant term becomes obvious.  With the constant term out of the polynomials they can be written as a product of simple terms of the form (s-zi).  This would not be possible if the highest order term of the polynomials was not equal to one.

Often the gain term is not given as part of the representation.  The nature of the behavior of the system is given by the poles and zeros (e.g., does it oscillate? decay quickly? ...), the gain term only determines the magnitude of the response.  In many cases a plot is made of the s-plane that shows the locations of the poles and zeros, and the gain term (k) is not shown.  See the example below.

##### Example: Transfer Function → Pole-Zero

Find the pole-zero representation of the system with the transfer function:

First rewrite in our standard form (note: the polynomials were factored with a computer).

So the pole-zero representation consists of:

• a constant term, k=3,
• zeros at s=-1 and s=-2, and
• polese at s=-1+j, s=-1-j and s=-3.

The plot below shows the poles (marked as "x") and the zeros (marked as "o") of the response.  The gain, k, is not shown.

##### Example: Pole-Zero → Transfer Function

Find the transfer function representation of a system with:

• a pole at the origin (s=0)
• poles at s=-2 and -3,
• a zero at s=1, and
• a constant k=4.

Note: if the value of k was not known the transfer function could not be found uniquely.

Erik Cheever       Department of Engineering         Swarthmore College

# Transformation: Transfer Function ↔ Signal Flow Graph

Given a system transfer function it is possible to derive a signal flow graph directly, but it is more convenient to first find a space model, and then move from the state space model to the signal flow graph.

##### Example: Transfer Function → Signal Flow Graph

Find a signal flow graph for the system described by the transfer function:

Step 1: Find a state space representation using the methods described here (TF ↔ SS).  In this case we are using a CCF form).

Step 2: Find a signal flow graph using the methods described here (TF ↔ SFG).

This example is not yet finished

##### Example: Signal Flow Graph→ Transfer Function

Repeat the previous example, but reverse the order (i.e., do step 2 (SFG → SS) then step 1 (SS → TF)).

A better way do this is to use Mason's gain formula.

Erik Cheever       Department of Engineering         Swarthmore College

# Transformation: State Space ↔ State Space

A state variable representation of a system is not unique.  In fact there are infinitely many representations.  Methods for transforming from one set of state variables to another are discussed below, followed by an example.

Consider the state space representation

We can define a new set of independent variables (i.e., T is invertible)

Though it may not be obvious we can use this new set of variables as state variables.  Start by solving for q

(note: some textbooks use the matrix P=T-1 to define the transformation)

We can now rewrite the state space model by replacing q in the original equations

Multiply the top equation by T to solve for

We recognize this as a state space representation

with

##### Example: State Space to State Space

Consider the system below:

We have shown that the choice of state variables

yields the state space system

If we want a set of state variables that includes the position of the center of the dashpot ½(x+y) as well as the extension of the dashpot (y-x), find a new state variable representation.

#### Solution:

Our new state variables are:

which we can write in terms of the old variables as:

so

with

##### Matlab Solution

Matlab code, html

Erik Cheever       Department of Engineering         Swarthmore College

# Transformation: State Space ↔ Pole-Zero

Given a state space representation it is possible to derive a pole-zero model directly, but it is more convenient to go first derive the transfer function, and then go from the transfer function to the pole-zero model model.

##### Example: State Space → Pole-Zero

Find a pole-zero model for the system described by the state space representation:

Step 1: Find the transfer function using the methods described here (SS ↔ TF)

Step 2: Find a pole-zero representation using the methods described here (TF ↔ PZ).  The pole-zero representation consists of:

• a constant term, k=3,
• zeros at s=-1 and s=-2, and
• poles at s=-1+j, s=-1-j and s=-3.
##### Example: Pole-Zero → State Space

Repeat the previous example, but reverse the order (i.e., do step 2 (PZ → TF) then step 1 (TF → SS).

Erik Cheever       Department of Engineering         Swarthmore College

# Transformation: State Space ↔ Signal Flow Graphs

This document is unfinished. It will detail how to transform back and forth from state space and signal flow graph/block diagram representations.

Erik Cheever       Department of Engineering         Swarthmore College

# Transformation: Pole-Zero ↔ Signal Flow Graph

Given a pole-zero representation of a system it is possible to derive a signal flow graph directly, but it is more convenient to go first derive the transfer function, and then go from the transfer function to the state space model, and then from the state space model to the signal flow graph.

##### Example: Pole-Zero→ Signal Flow Graph

Find a signal flow graph that represents the system with the following pole-zero description:

Step 1: Find the transfer function using the methods described here (PZ ↔ TF)

Step 2: Find a state space representation using the methods described here (TF ↔ SS).  In this case we are using a CCF form).

Step 3: Find a signal flow graph using the methods described here (SS ↔ SFG).

This example is not yet finished

##### Example: Signal Flow Graph → Pole-Zero

Repeat the previous example, but reverse the order (i.e., do step 3 (SFG → SS) then step 2 (SS → TF) then step 1(TF → PZ)).