user3049442
user3049442

Reputation: 74

Matlab: Linearizing Simulink model and getting linearized transfer function?

I want to determine the linearized transfer function from a non-linear system made in Simulink. I can see that it should be possible to use the linmod function in Matlab but when I try this

[num,den]=linmod('sys')

I'm not getting the numerator and denominator but instead the state space matrix etc. Can anyone help?

Upvotes: 2

Views: 3443

Answers (2)

am304
am304

Reputation: 13876

linmod always returns a state-space representation (see documentation). Use tf to convert your stae-space representation to a transfer function:

Conversion to Transfer Function

tfsys = tf(sys) converts the dynamic system model sys to transfer function form. The output tfsys is a tf model object representing sys expressed as a transfer function.

BTW, if you have Simulink Control Design, a better alternative to linmod is linearize.

Upvotes: 2

Robert Seifert
Robert Seifert

Reputation: 25232

Try the function balred instead: documentation

rsys = balred(sys,ORDERS) computes a reduced-order approximation rsys of the LTI model sys. The desired order (number of states) for rsys is specified by ORDERS. You can try multiple orders at once by setting ORDERS to a vector of integers, in which case rsys is a vector of reduced-order models. balred uses implicit balancing techniques to compute the reduced- order approximation rsys.

example:

Q = tf([1 2 3 4 5],[5 4 3 2 1])

Q =

   s^4 + 2 s^3 + 3 s^2 + 4 s + 5
  -------------------------------
  5 s^4 + 4 s^3 + 3 s^2 + 2 s + 1

Q_lin = balred(Q,2)

Q_lin =

  3.276 s^2 - 2.06 s + 2.394
  --------------------------
   s^2 - 0.2757 s + 0.4789

balred(Q,1)

is not working for my example, as there are 2 unstable poles, but it may works for your system.

Upvotes: 2

Related Questions