Skip to main content
Commonmark migration
Source Link

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 $\mathrm{abs}(a_{i+1} - a_i) > 3$, add $6 k \,$ to $a_{i+1}$, otherwise return $a_{i+1}$. If $a_{i+1} > a_i$ for the first time, $k = -1$, otherwise $k = 1$.

  • For every time $\mathrm{abs}(a_{i+1} - a_i) > 3$ and $a_{i+1} > a_i$, $k \to k + 1$ otherwise $k \to k - 1$.

    For example, the first time $\mathrm{abs}(a_{i+1} - a_i) > 3$, add $6$ if $a_{i+1} > a_i$. For the second time $\mathrm{abs}(a_{i+1} - a_i) > 3$, add $12$ if $a_{i+1} > a_i$. And for third time, if $a_{i+1} < a_i$, add $6$ not $18$.

For example, the first time $\mathrm{abs}(a_{i+1} - a_i) > 3$, add $6$ if $a_{i+1} > a_i$. For the second time $\mathrm{abs}(a_{i+1} - a_i) > 3$, add $12$ if $a_{i+1} > a_i$. And for third time, if $a_{i+1} < a_i$, add $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.

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 $\mathrm{abs}(a_{i+1} - a_i) > 3$, add $6 k \,$ to $a_{i+1}$, otherwise return $a_{i+1}$. If $a_{i+1} > a_i$ for the first time, $k = -1$, otherwise $k = 1$.

  • For every time $\mathrm{abs}(a_{i+1} - a_i) > 3$ and $a_{i+1} > a_i$, $k \to k + 1$ otherwise $k \to k - 1$.

For example, the first time $\mathrm{abs}(a_{i+1} - a_i) > 3$, add $6$ if $a_{i+1} > a_i$. For the second time $\mathrm{abs}(a_{i+1} - a_i) > 3$, add $12$ if $a_{i+1} > a_i$. And for third time, if $a_{i+1} < a_i$, add $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.

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 $\mathrm{abs}(a_{i+1} - a_i) > 3$, add $6 k \,$ to $a_{i+1}$, otherwise return $a_{i+1}$. If $a_{i+1} > a_i$ for the first time, $k = -1$, otherwise $k = 1$.

  • For every time $\mathrm{abs}(a_{i+1} - a_i) > 3$ and $a_{i+1} > a_i$, $k \to k + 1$ otherwise $k \to k - 1$.

    For example, the first time $\mathrm{abs}(a_{i+1} - a_i) > 3$, add $6$ if $a_{i+1} > a_i$. For the second time $\mathrm{abs}(a_{i+1} - a_i) > 3$, add $12$ if $a_{i+1} > a_i$. And for third time, if $a_{i+1} < a_i$, add $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.

Reformatted body and tried to clarify the parts I was sure about (i.e. I left "$k = -1$, otherwise $k = 1$", but I think it should be "$k = 1$, otherwise $k = -1$")
Source Link
NonDairyNeutrino
  • 7.9k
  • 1
  • 14
  • 31

I am facing a problem in unwrapping a phase.. I have a data set presented by a[i]. Where i$a_i$, where $i$ varies from 1$1$ to N$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

  • If $\mathrm{abs}(a_{i+1} - a_i) > 3$, add $6 k \,$ to $a_{i+1}$, otherwise return $a_{i+1}$. If $a_{i+1} > a_i$ for the first time, $k = -1$, otherwise $k = 1$.

  • For every time $\mathrm{abs}(a_{i+1} - a_i) > 3$ and $a_{i+1} > a_i$, $k \to k + 1$ otherwise $k \to k - 1$.

For example, for every time the abs value be greater than 3, eachfirst time there will be an addition of 6k (where k is an integer, it will increase 1,2,3$\mathrm{abs}(a_{i+1} - a_i) > 3$,... like this way or add -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$6$ if , for third time ot be +/- 18$a_{i+1} > a_i$. Again if a[i+1]>a[i] for the first time it will be For the addition of 6, if second time also$\mathrm{abs}(a_{i+1} - a_i) > 3$, add $12$ if a[i+1]>a[i] then the addition be 12$a_{i+1} > a_i$. And for third time, if a[i+1]<a[i] then addition will be 6$a_{i+1} < a_i$, add $6$ not 18$18$. So

So, can anyone please help me to write the code in mathematicaMathematica for the above logic. I am getting stuck. And And thank you in adv. for the help.

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.

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 $\mathrm{abs}(a_{i+1} - a_i) > 3$, add $6 k \,$ to $a_{i+1}$, otherwise return $a_{i+1}$. If $a_{i+1} > a_i$ for the first time, $k = -1$, otherwise $k = 1$.

  • For every time $\mathrm{abs}(a_{i+1} - a_i) > 3$ and $a_{i+1} > a_i$, $k \to k + 1$ otherwise $k \to k - 1$.

For example, the first time $\mathrm{abs}(a_{i+1} - a_i) > 3$, add $6$ if $a_{i+1} > a_i$. For the second time $\mathrm{abs}(a_{i+1} - a_i) > 3$, add $12$ if $a_{i+1} > a_i$. And for third time, if $a_{i+1} < a_i$, add $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.

edited title
Link
Roman
  • 49.8k
  • 2
  • 57
  • 131

Use of if and for loop Phase unwrapping

edited tags
Link
Loading
Source Link
P Pyne
  • 552
  • 2
  • 11
Loading