Reputation: 10931
A have a discrete time transfer function,
H(z-1) = B(z-1) / A(z-1) = (b0 + b1z-1) / (a0 + a1z-1 + a2z-2).
whose numerator and denominator are represented in the code as:
Num = [b0, b1];
Den = [a0, a1, a2];
Ts = 0.01; % Sampling period`
How do I use tf2ss()
to obtain the A
, B
, C
and D
state space matrices?
Do I directly call tf2ss()
like we do in continuous time system?
Or is there any other built-in Matlab function for this purpose?
Upvotes: 1
Views: 9448
Reputation: 11
first of all you should build your continuous state space model by using this: sys_state_space = tf2ss(a,b) after that you should use this: sys_ss_discrete = c2d(sys_state_space,T*-sampling*,'zoh')
then you have the state space discrete model of the system.
Upvotes: 1
Reputation: 119
Transfer functions to state space conversions are equal in continuous and discrete models. But, if you want the matrices in a system represented discretely you might want to do something like this
S = ss(tf(Num,Den,T))
Upvotes: 2
Reputation: 32930
Maybe I'm missing something in your question, but you can use it simply like this:
[A, B, C, D] = tf2ss(Den, Num);
You can also refer to the official tf2ss
documentation to confirm this.
Upvotes: 2