# bug #63636: [Octave Packages] (signal) cheby1 - imaginary residual in gain variable errors zp2tf

 Submitter: None Submitted: Mon 09 Jan 2023 09:04:35 PM UTC Category: Octave Forge Package Severity: 3 - Normal Priority: 5 - Normal Item Group: Unexpected Error or Warning Status: None Assigned to: None Originator Name: Originator Email: -email is unavailable- Open/Closed:  * Open Release:  * 7.1.0 Operating System:  * Microsoft Windows Fixed Release: None Planned Release: None
* Mandatory Fields

Add a New Comment Rich Markup

## Discussion

Sat 14 Jan 2023 10:32:49 AM UTC, comment #2:

This is the same kind of problem than reported in https://savannah.gnu.org/bugs/index.php?53649 for the function "tf" which has not yet been corrected.
Perhaps, all the function of same kind should be checked and improved, even if the workaround is simple.

Charles Praplan <charprap>
Mon 09 Jan 2023 09:14:44 PM UTC, comment #1:

Please strike "for the real axis zero (n is odd)". I think I am conflating some other residual issues with matlab's (an old ver) cheb1ap() when n is odd. The bug I have reported also occurs for n even.

Anonymous
Mon 09 Jan 2023 09:04:35 PM UTC, original submission:

This is a simple problem, so I embedded the test file cheby1_gain_error.m:

function cheby1_gain_error
% cheby1_gain_error - shows complex residual in cheby1 gain causes error in zp2tf.
n = 5
rp = 10*log10(2)
[z,p,k] = cheb1ap(n,rp)
[num_lp, den_lp] = zp2tf(z, p, k)

% >> which cheby1
% 'cheby1' is a function from the file C:\engineer\Octave-7.1.0\mingw64\share\octave\packages\signal-1.4.1\cheby1.m
% Line 115 is:
% gain = prod (-pole);
% Because of the method of computing "prod()", an imaginary residual is a
% possible result for the real axis zero (n is odd).
% While careful construction of the roots and then the computation of gain
% with those roots can avoid this, the brute force of enforcing real() upon
% prod() is likely a sufficient solution. Use
% gain = real (prod (-pole));

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 #54204:  cheby1_gain_error.m added by None (761B - application/octet-stream)

## Dependencies

Depends on the following items: None found

Items that depend on this one: None found

Carbon-Copy List
• -email is unavailable- added by arungiridhar (Updated the item)
• -email is unavailable- added by charprap (Posted a comment)
• -email is unavailable- added by None (Submitted the item)
•

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only project members can vote.