ss2tf error. The TF does not match.

4 views (last 30 days)
Álvaro Morales Muñoz
Álvaro Morales Muñoz on 23 Mar 2021
Edited: Star Strider on 23 Mar 2021
Dear all,
I am working in State-Sapce (SS) representation, so, when I want to obtain a Transfer Function (TF) in order to create a bode, the bode does not match with the expected frequency response. The A matrix in SS is 13x13. I tried with a simple example that I know what is its TF, and I do not obtain the expected resoult. How could I solve it? I think the problem is in the way that the determinant is calculated. It is not a problem to wait more time to obtain a more precise TF.
Thank you very much fot your time.
  2 Comments
Siddharth Jawahar
Siddharth Jawahar on 23 Mar 2021
Hi Alvaro,
Can you share an example of how you are doing this conversion?
Best,
Sid
Álvaro Morales Muñoz
Álvaro Morales Muñoz on 23 Mar 2021
This is the code:
format long
A = [
0 1 0 0 0 0 0 0 0 0 0 0 0;
0 0 1 0 0 0 0 0 0 0 0 0 0;
0 0 0 1 0 0 0 0 0 0 0 0 0;
0 0 0 0 1 0 0 0 0 0 0 0 0;
0 0 0 0 0 1 0 0 0 0 0 0 0;
0 0 0 0 0 0 1 0 0 0 0 0 0;
0 0 0 0 0 0 0 1 0 0 0 0 0;
0 0 0 0 0 0 0 0 1 0 0 0 0;
0 0 0 0 0 0 0 0 0 1 0 0 0;
0 0 0 0 0 0 0 0 0 0 1 0 0;
0 0 0 0 0 0 0 0 0 0 0 1 0;
0 0 0 0 0 0 0 0 0 0 0 0 1;
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1];
B = [1 0 0 0 0 0 0 0 0 0 0 0 0]';
C = [1 0 0 0 0 0 0 0 0 0 0 0 0];
D = 0;
[num, den] = ss2tf(A,B,C,D)
% The denominator should be [1 1 1 1 1 1 1 1 1 1 1 1 1], but I obtain in
% den =
% Columns 1 through 7
% 1.000000000000000 1.000000000000009 1.000000000000009 1.000000000000008 1.000000000000004 0.999999999999994 0.999999999999990
% Columns 8 through 14
% 0.999999999999994 1.000000000000001 1.000000000000004 1.000000000000001 0.999999999999996 0.999999999999999 0.999999999999999

Sign in to comment.

Answers (1)

Star Strider
Star Strider on 23 Mar 2021
Edited: Star Strider on 23 Mar 2021
The bode function accepts state space models as input. See the sys documentation section for an extended discussion.
EDIT — (23 Mar 2021 at 15:50)
Try this:
sys = ss(A,B,C,D);
figure
bode(sys)
grid
.

Communities

More Answers in the  Power Electronics Control

Community Treasure Hunt

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

Start Hunting!