Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Different results using SS and TF forms 1

Status
Not open for further replies.

electricpete

Electrical
May 4, 2001
16,774
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:
code1 said:
[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))
code2 said:
[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:

I think I have overlooked something. What?

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

Recommended for you

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
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor