help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C2D Function


From: Lukas Reichlin
Subject: Re: C2D Function
Date: Sun, 27 Nov 2011 06:29:38 +0100

On 26.11.2011, at 21:02, Luke Trowbridge wrote:

> Hello:
>  
> When I execute the following code:
>  
>  
> num = [5.0576e20, 0, 0, 0];
> den = [1, 2.5296e4, 1.002247e9, 1.4011535e13, 2.1985832e17, 1.417505e21, 
> 7.4138682e24, 1.588969e28, 1.6328178e31];
> atf = tf(num, den);
> dtf = c2d(atf, 1e-5);
>  
>  
> Octave 3.2.4 and control package 1.0.11 return a sensible result for the 
> variable dtf.  However, when the same code is executed with Octave 3.4.3 and 
> control package 2.2.1, the value of the variable dtf is given as follows:
>  
> Transfer function "dtf" from input "u1" to output ...
> y1:  0
> Continuous-time model.
>  
>  
> The C2D function seems to work fine in octave 3.4.3 if I use transfer 
> functions with numerator/denominator coefficients that are a little close 
> together (within 10^15).  How should I go about this continuous to digital 
> conversion in octave 3.4.3?
>  
> Thanks for any help,
> Luke Trowbridge

Hi Luke

The problem is not c2d. The problem is the transfer function to state-space 
conversion (internally, c2d is computed in state-space). You can try

num = [5.0576e20, 0, 0, 0];
den = [1, 2.5296e4, 1.002247e9, 1.4011535e13, 2.1985832e17, 1.417505e21, 
7.4138682e24, 1.588969e28, 1.6328178e31];
atf = tf(num, den);
dtf = c2d(atf, 1e-5);
ss (atf)

ans.d =
       u1
   y1   0

Continuous-time model.

The problem is caused by the very large num and den coefficients which lead to 
very small numbers in the observer canonical form (Wolovich's observable 
structure theorem) produced by Slicot TD04AD:

ss (atf)

ans.a =
               x1          x2          x3          x4          x5          x6   
       x7          x8
   x1   3.411e-13  -1.598e-13    2.14e-14           0           0           0   
        0      -163.3
   x2       -1000   -2.97e-15    1.65e-13           0           0           0   
        0       158.9
   x3           0       -1000  -6.094e-14           0           0           0   
        0      -74.14
   x4           0           0        1000           0           0           0   
        0      -14.18
   x5           0           0           0      -1e+04           0           0   
        0       21.99
   x6           0           0           0           0      -1e+05           0   
        0      -140.1
   x7           0           0           0           0           0      -1e+06   
        0   1.002e+04
   x8           0           0           0           0           0           0   
   -1e+05   -2.53e+04

ans.b =
               u1
   x1           0
   x2           0
   x3           0
   x4  -5.058e+04
   x5           0
   x6           0
   x7           0
   x8           0

ans.c =
            x1       x2       x3       x4       x5       x6       x7       x8
   y1        0        0        0        0        0        0        0  -0.0001

ans.d =
       u1
   y1   0

Continuous-time model.

With the chosen default tolerance in control/@tf/__sys2ss__.m, these are 
considered to be not of full rank and are cancelled. Result is a model with no 
remaining states and feedthrough matrice 0.

You can change line 118 in control/@tf/__sys2ss__.m from
  [a, b, c, d] = sltd04ad (ucoeff, dcoeff, index, sqrt (eps));
to
  [a, b, c, d] = sltd04ad (ucoeff, dcoeff, index, 0);
to get the result above and the discrete system dtf:


Transfer function "dtf" from input "u1" to output ...

      4.034e-07 z^7 + 8.808e-06 z^6 - 4.499e-06 z^5 - 3.418e-05 z^4 + 3.573e-05 
z^3 + 2.257e-06 z^2 - 8.186e-06 z - 3.408e-07
 y1:  
-----------------------------------------------------------------------------------------------------------------------
                   z^8 - 7.682 z^7 + 25.88 z^6 - 49.96 z^5 + 60.42 z^4 - 46.89 
z^3 + 22.8 z^2 - 6.353 z + 0.7765             

Sampling time: 1e-05 s
Discrete-time model.

I don't have a quick solution in general. But my advice is to properly scale 
input-output channels of your models as we do *numerical* computations after 
all where scaling is an important thing.

Best regards,
Lukas

reply via email to

[Prev in Thread] Current Thread [Next in Thread]