I am facing a problem in unwrapping a phase.. I have a data set presented by a[i]. Where i varies from 1 to N. I need it as follows: If abs(a[i+1]-a[i])>3 I need to add +/- 6 with a[i+1], otherwise it will be simply a[i+1]. Now the problem is if a[i+1]>a[i] then there will be -6 otherwise +6. Again, for every time the abs value be greater than 3, each time there will be an addition of 6k (where k is an integer, it will increase 1,2,3,... like this way or -1,-2,-3.. This way, or may increase or decrease satisfying the above all condition) that means for the first satisfying abs(a[i+1]-a[i])>3 addition will be +/- 6, for second satisfying abs(a[i+1]-a[i])>3 the addition will be +/- 12 , for third time ot be +/- 18. Again if a[i+1]>a[i] for the first time it will be the addition of 6, if second time also if a[i+1]>a[i] then the addition be 12 for third time if a[i+1]<a[i] then addition will be 6 not 18. So, can anyone please help me to write the code in mathematica for the above logic. I am getting stuck. And thank you in adv. for the help.
Phase unwrapping
P Pyne
- 552
- 2
- 11