Why does c2d changes the structure of the C matrix in the ss representation?

13 visualizzazioni (ultimi 30 giorni)
Hi, I have a pretty simple plant that I am discretising and then realising into its State-Space representation
Ix = 4.85e-3 % Intertia
Ts = 1/4e3 %sampling time, sec
P_tf = tf([1], [Ix,0,0]) %P_tf(s) = 1/(Ix * s^2) ,
ss(P_tf) % ss in continue time
P_tfd = c2d(P_tf, Ts, 'zoh')
ss(P_tfd) % ss in discrete time
The State Space representation of P_tf gives me a C matrix as such :
C =
x1 x2
y1 0 12.89
However, the State Space representation of P_tfd gives me a C matrix as such :
C =
x1 x2
y1 0.001649 0.001649
In my opinion, it doesn't make mush sense that the C matrix changes substantially: when I connect this plant to the controller, I'm only interested in observing the second value of the state ot the plant (like in continous time) so that I may compare it with the input to obtain the error. The new C obtained by the realisation of the discretised function instead gives me a weighted sum of the value and its derivative.
This happens also with other methods (I tried FOH and Tustin).
Does anyone know why this happens, and if there is a physical reason for it to happen, or how to correct it if not? I feel like it's not physically accurate, but I'm not very knowledgeable on such discretisation methods.
Thanks in advance!

Risposta accettata

Paul
Paul il 5 Mag 2025
Hi Elia,
When working with transfer functions, the only thing that's considered is the input/output relationship. The Control Systems Toolbox does not guarantee that the state variables of any realization of a transfer function have any physical meaning. We can see this in the system in the question, where it sounds like the input to the system is a torque, the first state is angular rate, and the second state is angular position (which is what you want to feed back to form an error signal.
Start with the transfer function representation of the double integrator scaled by the inertia
Ix = 4.85e-3; % Intertia
Ts = 1/4e3;
%sampling time, sec
P_tf = tf([1], [Ix,0,0]) %P_tf(s) = 1/(Ix * s^2) ,
P_tf = 1 ----------- 0.00485 s^2 Continuous-time transfer function.
Now check the output of ss
ss(P_tf)
ans = A = x1 x2 x1 0 0 x2 1 0 B = u1 x1 16 x2 0 C = x1 x2 y1 0 12.89 D = u1 y1 0 Continuous-time state-space model.
The fact that the C-matrix is not [0,1] indicates that the state variables do not represent position and its derivative. However, the input/output relationship represented by that ss model is still the input/output relationship of our physical system
tf(ans) % 1/Ix = 206.18
ans = 206.2 ----- s^2 Continuous-time transfer function.
It sounds like what you really want is for the state space model to represent they physics, in which case we have to write out the state space model explicitly ourselves to ensure the state variables have the meaning we want: x1 = rate, x2 = position, input = torque
P_ss = ss([0 0;1 0],[1/Ix;0],[0 1],0)
P_ss = A = x1 x2 x1 0 0 x2 1 0 B = u1 x1 206.2 x2 0 C = x1 x2 y1 0 1 D = u1 y1 0 Continuous-time state-space model.
Verify the input/output relationship
tf(P_ss)
ans = 206.2 ----- s^2 Continuous-time transfer function.
Now, when we apply c2d to a ss model, the state definitions are preserved
c2d(P_ss,Ts,'zoh')
ans = A = x1 x2 x1 1 0 x2 0.00025 1 B = u1 x1 0.05155 x2 6.443e-06 C = x1 x2 y1 0 1 D = u1 y1 0 Sample time: 0.00025 seconds Discrete-time state-space model.
In your original formulation, the output of P_tfd or ss(P_tfd) would still be position, so you could use the output as your feedback signal.
  1 Commento
Elia
Elia il 6 Mag 2025
Dear Paul,
thank you for your explanation. Indeed I wrote the system manually and I confirm that the outcome is as desired, just as you suggested.
I found suspicious that the C matric was [0 , 12.89] and the B matrix were [0 ; 16] instead of what you put manually, but I thought it might have been a strategy of MATLAb to avoid large numbers close to small numbers, as they are both multiplier of approx. 13 .

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by