octave-patch-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-patch-tracker] [patch #8827] mapping package: new functions wrap


From: Philip Nienhuis
Subject: [Octave-patch-tracker] [patch #8827] mapping package: new functions wrapTo 360, 2Pi, 180, Pi
Date: Tue, 22 Dec 2015 18:59:56 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0 SeaMonkey/2.38

Follow-up Comment #9, patch #8827 (project octave):

@comment #7

Yeah I overlooked the second minus sigh (oops), apologies.

But then I tried your latest wrapToPi (of comment #8 file #35824) to get:

>> a = wrapToPi (pi * [-10 : 1e-1 : 10]);
>> a (find (abs (a) > pi))
ans =
 Columns 1 through 8:
  -5.9690  -5.6549  -5.3407  -5.0265  -4.7124  -4.3982  -4.0841  -3.7699
 Columns 9 through 16:
  -3.4558  -5.9690  -5.6549  -5.3407  -5.0265  -4.7124  -4.3982  -4.0841
 Columns 17 through 24:
  -3.7699  -3.4558  -5.9690  -5.6549  -5.3407  -5.0265  -4.7124  -4.3982
 Columns 25 through 32:
  -4.0841  -3.7699  -3.4558  -5.9690  -5.6549  -5.3407  -5.0265  -4.7124
 Columns 33 through 40:
  -4.3982  -4.0841  -3.7699  -3.4558  -5.9690  -5.6549  -5.3407  -5.0265
 Columns 41 through 45:
  -4.7124  -4.3982  -4.0841  -3.7699  -3.4558


... where I see lots of wrapToPi outcomes outside of the [-pi, +pi]
interval...  
In fact this would be a nice base for a test.

Along those lines,

>> b = wrapTo180 (180 * [-5: 1 : 5]);
>> b (find (abs (b) > 180))
ans = [](1x0)


(...but we already agreed this seems to work fine),


>> c = wrapTo2Pi (2*pi * [-3 : 1e-1 : 3]);
>> c (find (c < 0 | c > 2*pi)) ## Note: single "|" !
ans =
 Columns 1 through 7:
   -6.28319   -5.65487   -5.02655   -4.39823   -3.76991   -3.14159   -2.51327
 Columns 8 through 14:
   -1.88496   -1.25664   -0.62832  -11.93805  -11.30973  -10.68142  -10.05310
 Columns 15 through 21:
   -9.42478   -8.79646   -8.16814   -7.53982   -6.91150   -6.28319   -5.65487
 Columns 22 through 28:
   -5.02655   -4.39823   -3.76991   -3.14159   -2.51327   -1.88496   -1.25664
 Column 29:
   -0.62832


,,which again doesn't match what Matlab says: "... wraps angles in lambda, in
radians, to the interval [0 2*pi]" and I see negative values in the outcome,


>> b = wrapTo360 (360 * [-5: 1 : 5]);
error: 'sgn' undefined near line 36 column 11
error: called from
    wrapTo360 at line 36 column 9


(....Hey!...)
In you latest wrapTo360, I clearly see:
:
  xwrap = sgn.*(x - 360*(x > 360));
:

Please, in your Octave terminal type:

which sgn

and report back.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?8827>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]