bugGNU Octave - Bugs: bug #33883, unwrap works correctly only if the...

 
 

bug #33883: unwrap works correctly only if the deltas <4*pi

Submitter:  Benja Krieg <zhop>
Submitted:  Fri 29 Jul 2011 11:39:03 AM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 3.4.2 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 31 Jul 2011 10:45:24 PM UTC, comment #5: 

Thanks, Andriy. I've pushed your second patch after testing it:

http://hg.savannah.gnu.org/hgweb/octave/rev/7cdf39348879

Closing this bug.

Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Sun 31 Jul 2011 10:25:52 PM UTC, comment #4: 

unwrap.m: Fix incorrect behavior when unwrapping gaps larger then 2*pi with tests for it (Bug #33883)

Fixed issue in test when for row matrice specifing dim=1, but should be dim=2.
Some fixes in formatting and 3d array test added.

(file #23723)

Andriy Shinkarchuck <andruxoid>
Sun 31 Jul 2011 06:43:06 PM UTC, comment #3: 

Patch is ready!

unwrap.m: Fix incorrect behavior when unwrapping gaps larger then 2*pi with tests for it (Bug #33883)

I have modified unwrap.m in such way, that it multiplies kronecker deltas by smallest integer not less than integral part from dividing differencies between neighbour elements by rng, which equals 2*pi.

Thus incorrect behaviour in unwrapping only for 2*pi after first unwrap() call, and by 2*pi at every unwrap() call fixed.

Also i have modified comment to corrected line where p (peaks) calculated and added usual tests for checking of correct passing default parametres, tests for checking unwrap() for gaps larger then 2*pi and error test.

(file #23718)

Andriy Shinkarchuck <andruxoid>
Sat 30 Jul 2011 03:32:39 PM UTC, comment #2: 


>> unwrap ([0, 7*pi])


ans =

         0    3.1416

>> unwrap ([0, -7*pi])


ans =

         0   -3.1416

>> unwrap ([0, 8*pi])


ans =

     0     0


>> version


ans =

7.9.0.529 (R2009b)

>>


As expected.


Michael Godfrey <godfrey>
Group Member
Sat 30 Jul 2011 02:34:46 PM UTC, comment #1: 

Confirmed on a recent development tip.

For compatibility, what is Matlab's response for


unwrap ([0, 7*pi])
unwrap ([0, -7*pi])
unwrap ([0, 8*pi])


Rik <rik5>
Group administrator
Fri 29 Jul 2011 11:39:03 AM UTC, original submission:  

The function must be idempotent per definition

============
-- Function File: B = unwrap (X, TOL, DIM)
     Unwrap radian phases by adding multiples of 2*pi as appropriate to
     remove jumps greater than TOL.  TOL defaults to pi.
============

but:

octave:62> unwrap([0 6*pi])
ans =

    0.00000   12.56637

octave:63> unwrap(unwrap([0 6*pi]))
ans =

   0.00000   6.28319

octave:64> unwrap(unwrap(unwrap([0 6*pi])))
ans =

   0   0

octave:65>



Benja Krieg <zhop>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #23723:  my_fix.patch added by andruxoid (2KiB - text/x-diff)
file #23718:  my_fix.patch added by andruxoid (2KiB - text/x-diff - unwrap.m: Fix incorrect behavior when unwrapping gaps larger then 2*pi with tests for it (Bug #33883))

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jordigh (Posted a comment)
  • -email is unavailable- added by andruxoid (Updated the item)
  • -email is unavailable- added by godfrey (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by zhop (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-07-31 jordigh StatusNeed Info Fixed
        Open/ClosedOpen Closed
    2011-07-31 andruxoid Attached File- Added my_fix.patch, #23723
    2011-07-31 andruxoid Attached File- Added my_fix.patch, #23718
    2011-07-30 rik5 StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code