Ben
Ben

Reputation: 125

Substitute variable in Maxima

newbie Maxima question

I have a transfer function in Maxima

E1 : y = K_i*s/(s^2 + w^2);

I'd like to have the closed-form of the equation affter applying the bilinear transform

E2 : s = (2/Ts*(z-1)/(z+1));

I would like to get the transfer function for z, by substituing s by equation E2. How should I proceed?

Regards

Upvotes: 2

Views: 228

Answers (1)

Robert Dodier
Robert Dodier

Reputation: 17595

Note that subst can apply one or more substitutions stated as equations. In this case, try subst(E2, E1).

That will probably create a messy result -- you can simplify it somewhat by applying ratsimp to the result.

Here's what I get from that.

(%i2) E1 : y = K_i*s/(s^2 + w^2);         
                                K_i s
(%o2)                      y = -------
                                2    2
                               w  + s
(%i3) E2 : s = (2/Ts*(z-1)/(z+1));
                             2 (z - 1)
(%o3)                    s = ----------
                             Ts (z + 1)
(%i4) subst (E2, E1);
                           2 K_i (z - 1)
(%o4)          y = ------------------------------
                                         2
                                4 (z - 1)      2
                   Ts (z + 1) (------------ + w )
                                 2        2
                               Ts  (z + 1)
(%i5) ratsimp (%);
                                 2
                       2 K_i Ts z  - 2 K_i Ts
(%o5)  y = -----------------------------------------------
              2  2       2        2  2            2  2
           (Ts  w  + 4) z  + (2 Ts  w  - 8) z + Ts  w  + 4

Upvotes: 1

Related Questions