×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Different results using SS and TF forms

Different results using SS and TF forms

Different results using SS and TF forms

(OP)
Many function (such as cheby2) allow us to generate state space (SS) form of a system if we specify 4 arguments, or transfer function form if we specify two arguments.

freqz expects TF as an input, so if I have a SS, I need to convert it first.

I would expect the following two codes to gives similar plots:

Quote (code1):

[A,B,C,D]=cheby2(9,20,0.75);  % 9th order filter, 30 db down at cutoff of 0.75*Fmax
freqz(ss2tf(A,B,C,D))

Quote (code2):


[A,B]=cheby2(9,20,0.75);
freqz(A,B)

But they do not give the same results.  The second one gives the expected plot (20 db down at frequency 0.75).

Code and output shown here:
http://home.comcast.net/~electricpete/eng-tips/FilterQuestion.doc

I think I have overlooked something.  What?

=====================================
Eng-tips forums: The best place on the web for engineering discussions.

RE: Different results using SS and TF forms

It is a coding standard problem.  You did not return the results of thebuilt in function, the the reviewer and maintenance people can not determine correct behaviour at a glance.  Try doint it in two steps, the ss2tf returns b before a.

[b,a] = ss2tf(A,B,C,D,iu)

jsolar

RE: Different results using SS and TF forms

(OP)
Thanks!  Based on your comments, I tried and figured out that:

This gives the correct result:
[A,B,C,D]=cheby2(9,20,0.75);
[a b] = ss2tf(A,B,C,D)
freqz(a,b)

This does not:
[A,B,C,D]=cheby2(9,20,0.75);  
freqz(ss2tf(A,B,C,D))

=============
It appears that ss2tf(A,B,C,D) returns only half the answer.  I can only get the full answer using [x,y]=ss2tf(A,B,C,D)

ss2tf(A,B,C,D)

ans =

  Columns 1 through 7

    0.4657    3.5534   12.5944   27.1445   39.1463   39.1463   27.1445

  Columns 8 through 10

   12.5944    3.5534    0.4657

ยป [a b]=ss2tf(A,B,C,D)

a =

  Columns 1 through 7

    0.4657    3.5534   12.5944   27.1445   39.1463   39.1463   27.1445

  Columns 8 through 10

   12.5944    3.5534    0.4657


b =

  Columns 1 through 7

    1.0000    6.2604   18.4834   33.5098   40.9165   34.7873   20.5536

  Columns 8 through 10

    8.1288    1.9519    0.2169

=====================================
Eng-tips forums: The best place on the web for engineering discussions.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources