22 Sep 2012

Matlab: Convert state space model to transfer function without ‘ss2tf()’ function

Hello everyone! In this post I want to share with you a simple Matlab program to convert state space model to transfer function.

In modern control systems, state space models are in common use because of its advantage over classical control system involving transfer function. One of the most common advantage is transfer function can be used only for zero initial condition, whereas state space models can be used for systems involving both zero and non-zero initial conditions.


Now let us come to the main topic, i.e. converting state space model to transfer function in Matlab. In Matlab, we can perform this task in 2 ways:

  1. Using the direct command ‘SS2TF()
  2. Without using ‘SS2TF()’ command

Let me brief about each of the 2 ways:

I.    Using Direct command
In this way, Just enter the matrix A,B,C and D from the state space model of

X'=Ax+Bu
Y=Cx+Du


And then use the syntax:

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


This will return the numerator and denominator of the transfer function. The Matlab codes are shown below:

 
%program to convert state space model to transfer function
%using SS2TF() function
%Author:    Amit Biswal @ Speaking Technology
%URL:       http://amitbiswal.blogspot.com
clc
clear all
A=[0 1 0;0 0 1; -1,-2,-4]
B=[0;0;10]
C=[1 0 0]
D=[0]
[num,den]=ss2tf(A,B,C,D)
T=tf(num,den)


II.    Without using direct command

In this method, we will use our theoretical knowledge and apply the formula for transforming state space model to transfer function, i.e

T(s)=C(sI-A)-1B+D

The Matlab codes for the same are shown below:

 
%program to convert state space model to transfer function
%without using SS2TF() function
%Author:    Amit Biswal @ Speaking Technology
%URL:       http://amitbiswal.blogspot.com
clc
clear all
A=[0 1 0;0 0 1; -1,-2,-4]
B=[0;0;10]
C=[1 0 0]
D=[0]
s=tf([1 0],1);
I=eye(3);
T=(C*((inv((s*I)-A))*B))+D


Related Post :


1 comment:

  1. Anonymous11/05/2012

    Very good blog! Do you have any recommendations for aspiring writers?

    I'm hoping to start my own blog soon but I'm a little lost on everything.
    Would you suggest starting with a free platform
    like Wordpress or go for a paid option? There are so many options out there
    that I'm completely confused .. Any suggestions? Kudos!
    my web page - best fridge for the money

    ReplyDelete

If you liked this blog then Join me at:
Facebook
Twitter
RSS