1

I am trying to convert a state-space model to a transfer function in matlab RS2016a. I am using the function ss2tf(A,B,C,D) which according to the documentation does exactly what I need. As an example I am using a static gain of 2.

Answer that matlab returns:

>> ss2tf(0,0,0,2)
ans =
    2   0

*edit: [2,0] represents the transfer function 2/0 in the s domain. A transfer function with 0 as denominator does not make much sense and in this particular case it is wrong. The correct answer is [2,1] which represents the transfer function 2/1 instead of 2/0.

*original: [2,0] represents the transfer function 2/0 in the s domain. In my opinion the answer should be [2,1] and therefore the transfer function should be 2/1 instead of 2/0.

expected answer:

>> ss2tf(0,0,0,2)
ans =
    2   1

Is there an explanation for this behavior?

KasparJohannes
  • 520
  • 2
  • 7
  • 26
  • 6
    "In my opinion " what do you mean *in your opinion*. This is a mathematical problem, not a subjective problem. In my opinion `ss2tf` should cook a nice pizza for dinner, but unfortunately it represents a state space into transfer function. Its a pity it doesnt do what in my opinion should do, but well, it does rigthly the thing its supposed to do – Ander Biguri Mar 23 '16 at 16:48
  • You are right, "In my opinion" is not an ideal way to say what I wanted to say. It would be great though if the function would be able to cook pizza for dinner ;-) – KasparJohannes Mar 23 '16 at 17:17

1 Answers1

4

ss2tf is a function with two output arguments, call it with two output arguments:

[b,a]=ss2tf(0,0,0,2)

You are only reading the nominator and the denominator a is lost the way you are calling the function.

Daniel
  • 36,610
  • 3
  • 36
  • 69
  • When using the function correctly the output is: `>> [NUM,DEN]=ss2tf(0,0,0,2) NUM = 2 0 DEN = 1 0` This represents the tf 2*s/s which is equivalent to 2/1 and therefore correct. I am wondering though why matlab does not simplify the tf by itself... – KasparJohannes Mar 23 '16 at 18:11
  • There are some advantages having functions which return results of predictable size. – Daniel Mar 23 '16 at 18:20