Adapting Unwrapping Techniques for Plotting Phase Values

  • Mathematica
  • Thread starter Swamp Thing
  • Start date
  • Tags
    Phase Plot
In summary, the conversation discusses the use of list unwrapping to create a jump-free graph in plotting. The proposed approach involves using a function called fnUnwrap2, which takes into account successive phase values and maintains cumulative jumps. However, this approach has some issues with spikes and offsets in the resulting graph. The conversation ends with a suggestion to store not only the old phase value but also the old x-value, which may help avoid confusing the plotting algorithm.
  • #1
Swamp Thing
Insights Author
907
572
TL;DR Summary
Plotting Arg[ f[x] ] gives output that has jumps of +/- 2Pi and is limited to +-Pi.
Can we unwrap this into a jumpless plot?
This discussion https://community.wolfram.com/groups/-/m/t/1340126 includes some ideas to unwrap a list of wrapped-around values such as phase (e.g. Arg[ f[N] ] ). You can use this to ListPlot a jump-free graph.

I'm trying to adapt this to work in Plot rather than ListPlot. The idea is to plot fnUnwrap [ myPhase[t] ], where fnUnwrap is called whenever the plotter wants to evaluate the Y value.

Now fnUnwrap needs to use two successive phase values, and also maintain a cumulative total of all the jumps. So we store some "state information" in the variables unwrap`old and unwrap`cumu, i.e. the previous input and the accumulated jumps. Here is my attempt:
Code:
fnUnwrap2[new_,\[CapitalDelta]_,tol_]:=Module[{jmp},
                                    jmp=new-unwrap`old;
                                    jmp=-Sign[jmp] Unitize[        Chop [ Abs[jmp],tol      ]   ];
                                    jmp= jmp *  \[CapitalDelta];
                                    unwrap`cumu=unwrap`cumu+jmp;
                                    unwrap`old=new;
                                    new + unwrap`cumu
                                                                                  ]

This code "sort of" works, but has these spikes around the jump points and has an offset as well:

Code:
unwrap`old=0
unwrap`cumu=0

Plot[{ fnUnwrap2[Mod[ x, 2],2,1.75],
           x
        
    },{x,0,12},PlotRange->All,PlotPoints->250]

Output:
1635757404617.png


Can this be fixed , or is there a better approach?
 
Last edited:
Physics news on Phys.org
  • #2
Perhaps part of the problem is that the plotting algorithm often evaluates Arg[f[x]] in a random sequence of X. Maybe we need to store not only old_Arg but also old_X, and somehow use that to avoid confusing the plotting algorithm.

Any suggestions much appreciated.
 
Last edited:

1. What is the unwrapped plot of a phase?

The unwrapped plot of a phase is a graphical representation of the phase angle of a signal or system as a function of frequency. It is created by unwrapping the phase data to remove any discontinuities and plotting it against the frequency.

2. Why is the unwrapped plot of a phase important in scientific research?

The unwrapped plot of a phase is important because it provides valuable information about the behavior and characteristics of a signal or system. It can help researchers understand the frequency response, stability, and other properties of a system.

3. How is the unwrapped plot of a phase calculated?

The unwrapped plot of a phase is calculated by first obtaining the phase data of a signal or system, typically through measurements or simulations. Then, the phase data is unwrapped to remove any jumps or discontinuities and plotted against the frequency using specialized software or mathematical algorithms.

4. What are some common applications of the unwrapped plot of a phase?

The unwrapped plot of a phase is commonly used in fields such as signal processing, telecommunications, and control systems. It can also be applied in fields such as acoustics, optics, and electronics to analyze the behavior of signals and systems.

5. Can the unwrapped plot of a phase be used to predict future behavior of a system?

While the unwrapped plot of a phase can provide valuable insights into the behavior of a system, it cannot predict future behavior on its own. It is typically used in conjunction with other analysis techniques to make predictions and inform decision-making in scientific research.

Back
Top