Transfer function long format

Hi,
So I wrote this function to give me the transfer function of a state space model.
A = [0,1,0;0,-1,2;0,0,-2];
B = [0;0;1];
C = [1,0,0];
D = 0;
[n,d] = ss2tf(A,B,C,D); % gives numerator and denominator of transfer function
partCtf = tf(n,d); % takes numerator and denominator and rearrange them into a proper fraction
display(partCtf);
However, it keeps giving me this transfer function
Transfer function:
2.665e-015 s^2 + 1.332e-015 s + 2
---------------------------------
s^3 + 3 s^2 + 2 s
When i compute the transfer function by hand, i get the same answer except for the two first values in the numerator, they should be zero. Is there anyway so I can make it so the first two values in the numerator are zero?

Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 9 Dec 2012
Edited: Azzi Abdelmalek on 9 Dec 2012
2.665e-015 is almost equal to zero, because of numerical errors. to eliminate the two first elements
n(1:2)=[]
model=tf(n,d)

Categories

Asked:

on 9 Dec 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!