# bug #60475: [ocatave forge] (signal) buttap poles have a different order

 Submitted by: None Submitted on: Thu 29 Apr 2021 12:00:45 PM UTC Category: Octave Forge Package Severity: 2 - Minor Priority: 3 - Low Item Group: Matlab Compatibility Status: Confirmed Assigned to: None Originator Name: Originator Email: -email is unavailable- Open/Closed: Open Release: dev Operating System: Any

You are not logged in

## Discussion

Wed 05 May 2021 03:25:05 PM UTC, comment #4:

@Charles

Thank you, this was more of a question as to the differences. As you note there an order but it is not consistent.
Should there be?

Mike suggested a fix, and this was updated.

Is a better example to work through to get an understanding and improve these functions?

For your comment on cheb1ap see patch #10059

Anonymous
Wed 05 May 2021 08:41:55 AM UTC, comment #3:

Different zero and poles ordering is not an error.
Even Matlab does not sort poles and zeros in complex conjugate pairs.
In the page following the one you cite, you have an example:

Matlab:

>> [z,p,k]=cheb1ap(4,2)

z =
[]
p =
-0.1049 + 0.9580i
-0.2532 + 0.3968i
-0.2532 - 0.3968i
-0.1049 - 0.9580i
k =
0.1634

Note that for the same example Octave returns a complex gain, what is not very good:

>> [z,p,k]=cheb1ap(4,2)

z = [](0x1)
p =

-0.1049 - 0.9580i
-0.2532 - 0.3968i
-0.2532 + 0.3968i
-0.1049 + 0.9580i

k =  1.6345e-01 + 2.7559e-18i

Charles Praplan <charprap>
Fri 30 Apr 2021 09:22:20 AM UTC, comment #2:

See patch

Updated p

Docstring
Tests

Anonymous
Thu 29 Apr 2021 08:52:43 PM UTC, comment #1:

We can use the cplxpair function to sort and group complex conjugate pairs together. That doesn't look to be the same as the Matlab results either, but it's a worthwhile improvement.

>> p = cplxpair (p)
p =

-0.8090 - 0.5878i
-0.8090 + 0.5878i
-0.3090 - 0.9511i
-0.3090 + 0.9511i
-1.0000 +      0i

Mike Miller <mtmiller>
Thu 29 Apr 2021 12:00:45 PM UTC, original submission:

[z, p, k] = buttap(5)
z =
[]
p =
-0.3090 + 0.9511i
-0.3090 - 0.9511i
-0.8090 + 0.5878i
-0.8090 - 0.5878i
-1.0000
k =
1

In Octave

[z, p, k] = buttap(5)
z = [](0x1)
p =

-0.30902 + 0.95106i
-0.80902 + 0.58779i
-1.00000 + 0.00000i
-0.80902 - 0.58779i
-0.30902 - 0.95106i

k =  1

The values are the same for p but the order is different.

Anonymous

## Attached Files

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Comment:

Attached Files
file #51342:  buttap.patch added by None (2KiB - text/x-patch)

## Dependencies

Depends on the following items: None found

Items that depend on this one: None found

Carbon-Copy List
• -email is unavailable- added by charprap (Posted a comment)
•

Do you think this task is very important?
This task has 0 encouragements so far.

Only project members can vote.