bugGNU Octave - Bugs: bug #41958, signal package: fir2 interpolation...

 
 

bug #41958: signal package: fir2 interpolation incompatible with octave 3.8

Submitter:  Wilson Guerrero Coltters <wcoltters>
Submitted:  Tue 25 Mar 2014 05:26:12 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  mtmiller
Originator Name:  Wilson Guerrero Coltters Open/Closed:  * Closed
Release:  * 3.8.0 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 11 Jan 2015 04:54:53 PM UTC, comment #4: 

Added tests to ensure fir1 and fir2 continue to work in https://sourceforge.net/p/octave/signal/ci/b90533e5618273fc385024c567ef87fa46414092/

Mike Miller <mtmiller>
Group Member
Wed 09 Apr 2014 02:09:17 AM UTC, comment #3: 

So the underlying bug that causes this problem has been fixed (bug #41980). This was a 3.8.1 bug that will be fixed in 3.8.2 or 4.0.

I'd like to add some tests to the fir2 function to make sure it works as expected going forward. I'll leave this open as a reminder to add tests to fir2.

Mike Miller <mtmiller>
Group Member
Tue 25 Mar 2014 10:55:34 PM UTC, comment #2: 

Moreover, I can confirm that this bug affects the signal package under Octave 3.8 but not under 3.6 or earlier. The reason is a change in the interp1 function to no longer allow piecewise linear interpolation of discontinuous functions. A change to fir2 is needed to do essentially what it used to do with interp1 without relying on this now-unsupported feature.

Specifically, something like this


x = interp1 ([0 0.5 0.5 1], [0 0 1 1], linspace (0, 1, 1000));


used to give x that was equivalent to


x = [zeros(1,500) ones(1,500)];


and now no longer does in Octave 3.8.

I am assigning myself to this bug, but please feel free to provide a patch if this is of interest to anyone else.

Mike Miller <mtmiller>
Group Member
Tue 25 Mar 2014 06:21:22 PM UTC, comment #1: 

Confirmed, retitling to reflect the real problem is in fir2.

The fir1 function is a thin wrapper around the fir2 function, where most of the work is done. The following example calls to fir2 demonstrate the errors from the linked document:


b = fir2 (48, [0 0.7 0.7 1], [0 0 1 1]);
b = fir2 (48, [0 0.25 0.25 0.75 0.75 1], [0 0 1 1 0 0]);
b = fir2 (48, [0 0.45 0.45 0.55 0.55 1], [1 1 0 0 1 1]);


Mike Miller <mtmiller>
Group Member
Tue 25 Mar 2014 05:26:12 PM UTC, original submission:  

From page

http://www.sharetechnote.com/html/Octave_Matlab_SignalProcessing.html

If you execute the examples, e.g.:


b = fir1(48,[0.45 0.55],'stop');
stem(b);
figure;
freqz(b,1,512);


you will get incorrect results compared with the results shown on the page and also compared with results with Matlab.

Only the function with 'low' delivers correct results.

OpenSUSE 12.3
octave 3.8.1-70.1
octave-forge-signal 1.3.0-63.3





Wilson Guerrero Coltters <wcoltters>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by wcoltters (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 group members can vote.

     

    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-01-11 mtmiller StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2014-03-28 mtmiller Dependencies- Depends on bugs #41980
    2014-03-25 mtmiller Assigned toNone mtmiller
    2014-03-25 mtmiller Releaseother 3.8.0
        Summarysignal package: fir2 function incorrect results for high-pass, band-pass, band-stop filters signal package: fir2 interpolation incompatible with octave 3.8
    2014-03-25 mtmiller StatusNone Confirmed
        Release3.8.1 other
        Operating SystemGNU/Linux Any
        Summaryoctave-forge-signal fir1 function incorrect results signal package: fir2 function incorrect results for high-pass, band-pass, band-stop filters

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code