2
votes
p(1)= 0.
p(2)= 0.6771057
p(3)= 0.8277359
p(4)= 1.3828832
p(5)= 1.7971431
p(6)= 2.1882188
p(7)= 2.6911235
p(8)= 3.1073485
p(9)=-2.7161114
p(10)=-2.3440447
q=unwrap(p,2*%pi) 

gives a wrong result. -2*pi has been subtracted to p(2). That's not correct. q(2)=-5.6060796

q  = 

0.
-5.6060796
-5.4554495
-4.9003021
-4.4860422
-4.0949665
-3.5920618
-3.1758368
-2.7161114
-2.3440447
1
Please post the result for each input value - Joe Taras

1 Answers

2
votes

I think there is a bug in the lastest version of unwrap. You can edit its source

--> edit unwrap

and comment out line 102:

//wh = abs(ju)>5*abs(avL)

Then exec unwrap.sci in the editor to update its definition. After this fix unwrap seems to work fine on your example:

p(1)= 0.
p(2)= 0.6771057
p(3)= 0.8277359
p(4)= 1.3828832
p(5)= 1.7971431
p(6)= 2.1882188
p(7)= 2.6911235
p(8)= 3.1073485
p(9)=-2.7161114
p(10)=-2.3440447
q=unwrap(p,2*%pi);
plot(1:10,p,1:10,unwrap(p,2*%pi))
legend("wraped","unwraped",2)

enter image description here