The modeling equation gathered from the free body diagram is in the time domain.  Some analysis are easier to perform in the frequency domain.  In order to convert to the frequency domain, apply the Laplace Transform to determine the transfer function of the system.

The Laplace Transform converts linear differential equations into algebraic expressions which are easier to manipulate.  The Laplace Transform converts functions with a real dependent variable (such as time) into functions with a complex dependent variable (such as frequency, often represented by s). 

The transfer function is the ratio of the output Laplace Transform to the input Laplace Transform assuming zero initial conditions.  Many important characteristics of dynamic or control systems can be determined from the transfer function. 

The general procedure to find the transfer function of a linear differential equation from input to output is to take the Laplace Transforms of both sides assuming zero conditions, and to solve for the ratio of the output Laplace over the input Laplace.

HOW TO FIND THE TRANSFER FUNCTION

In most cases the governing equation will be linear, consisting of a variable and its derivatives.  The Laplace Transform allows a linear equation to be converted into a polynomial.  The most useful property of the Laplace Transform for finding the transfer function is the differentiation theorem.  Several properties are shown below:
  Time Domain Frequency Domain
Linearity f(t) + g(t)
Function x(t)
1st Derivative x'(t)
2nd Derivative x"(t)
nth Derivative xn(t)

Note:  While linearity allows Laplace Transforms to be added, the same does not hold true for multiplication.  f(t)g(t) does not equal F(s)G(s).  The solution to multiplication requires convolution, please refer to a differential equations book.

In order to convert the time dependent governing equation to the frequency domain, perform the Laplace Transform to the input and output functions and their derivatives.  These transformed functions must then be substituted back into the governing equation assuming zero initial conditions.  Because the transfer function is defined as the output Laplace function over the input Laplace function, rearrange the equation to fit this form.

EXAMPLE

Find the transfer function of the second order tutorial example problem:

From the free body diagram we were able to extract the following governing equation:

f(t) - kx - bx' - mx" = 0

The notation of the Laplace Transform operation is L{ }.

 When finding the transfer function, ‘zero’ initial conditions must be assumed, so x(0) = x'(0) = 0.

 Taking the Laplace Transform of the governing equation results in:

F(s) - k[X(s)] - b[sX(s)] - m[s2X(s)] = 0

Collecting all the terms involving X(s) and factoring leads to:

[ms2 + bs + k] X(s) = F(s)

The transfer function is defined as the output Laplace Transform over the input Laplace Transform, and so the transfer function of this second order system is:

X(s)/F(s) = 1/[ms2 + bs + k]

 

HOW TO INPUT THE TRANSFER FUNCTION INTO MATLAB

In order to enter a transfer function into MATLAB, the variables much be given numerical value, because MATLAB cannot manipulate symbolic variables without the symbolic toolbox.  Enter the numerator and denominator polynomial coefficients separately as vectors of coefficients of the individual polynomials in descending order.   The syntax for defining a transfer function in MATLAB is:

transferfunction = tf(num, den)

where num is defined as the vector of numerator coefficients, and den is defined as the vector of denominator coefficients.

EXAMPLE

Input the transfer function X(s)/F(s) = 1/[ms2 + bs + k] into MATLAB:

For illustration purposes, this example uses m = 2, b = 5, and k = 3.

>> m = 2;
>> b = 5;
>> k = 3;
>> num = [ 1 ];
>> den = [ m b k ];
>> tutorial_tf = tf(num, den)

MATLAB will assign the transfer function under the name tutorial_tf, and output the following:

Transfer function:
       1
---------------
2 s^2 + 5 s + 3

 

 

STEP RESPONSE USING THE TRANSFER FUNCTION

Once the transfer function is entered into MATLAB it is easy to calculate the response to a step input.  To calculate the response to a unit step input, use:

step(transferfunction)

where transferfunction is the name of the transfer function of the system.

For steps with magnitude other than one, calculate the step response using:

step(u * transferfunction)

where u is the magnitude of the step and  transferfunction is the name of the transfer function of the system.

EXAMPLE

Find the unit step response and the step response when u = 4 of  tutorial_tf using MATLAB:

To find the unit step response:

>> step(tutorial_tf)

The MATLAB output will be the following plot of the unit step response:

To find the step response when u = 4:

>> u = 4;

>> step(u * tutorial_tf)

The MATLAB output will be the following plot of the step response:

 

 

 

IMPULSE RESPONSE USING THE TRANSFER FUNCTION 

MATLAB can also plot the impulse response of a transfer function.  Because the transfer function is in the form of output over input, the transfer function must be multiplied by the magnitude of the impulse.  The syntax for plotting the impulse response is: 

impulse(u * transferfunction)

where u is the magnitude of the impulse and  transferfunction is the name of the transfer function of the system.

EXAMPLE

Find the impulse response of  tutorial_tf with an input of u = 2 using MATLAB:

>> u = 2;

>> impulse(u * tutorial_tf)

The MATLAB output will be the following plot of the impulse response:

 

 

 

BODE PLOT USING THE TRANSFER FUNCTION

MATLAB’s bode command plots the frequency response of a system as a bode plot.  The syntax for the bode plot function in MATLAB is:

bode(transferfunction)

where transferfunction is the name of the transfer function system.

EXAMPLE

Find bode plot of the frequency response of the system tutorial_tf using MATLAB:

>> bode(tutorial_tf)

The MATLAB output will be the following bode plot of the frequency response:

 

 

STATE SPACE FROM TRANSFER FUNCTION

MATLAB can find the state space representation directly from the transfer function in two ways.  To find the state space representation of the system from the numerator and denominator of the transfer function in the form

x' = Ax + Bu

y = Cx + Du

use MATLAB's tf2ss command:

[A, B, C, D] = tf2ss(num,den)

where num is the vector of the numerator polynomial coefficients, and den is the vector of the denominator polynomial coefficients.

In order to find the entire state space system in addition to the separate matrices from the transfer function, use the following command:

statespace = ss(transferfunction)

where transferfunction is the name of the transfer function system.

EXAMPLE

Find A, B, C, and D, the state space vectors of  tutorial_tf using MATLAB:

>> [A, B, C, D] = tf2ss(num,den)

The MATLAB output will be:

A =
 
   -2.5000   -1.5000
    1.0000         0
 

B =
 
     1
     0
 

C =
 
         0    0.5000
 

D =
 
     0

Find the state space system of  tutorial_tf using MATLAB:

>> tutorial_ss = ss(tutorial_tf)

MATLAB will assign the state space system under the name tutorial_ss, and output the following:

 
a =
           x1      x2
   x1    -2.5  -0.375
   x2       4       0
 
 
b =
         u1
   x1  0.25
   x2     0
 
 
c =
        x1   x2
   y1    0  0.5
 
 
d =
       u1
   y1   0
 
Continuous-time model.

Carnegie Mellon University | University of Michigan

Mechanical Engineering Department