Unexpected behaviour with the unwrap() command

22 visualizzazioni (ultimi 30 giorni)
Tim
Tim il 28 Mar 2023
Commentato: Adam Danz il 4 Apr 2023
Hi everyone, i have the plots on the left with phasejumps. If I use the command unwrap the phasejumps get eliminated but I don't understand why for curve 2 and 3 the correction results in the negative while for curve 4, the curve gets corrected to the positive. For what I need line 2 and 3 are corrected "wrong" and only curve 4 is as I want it. I use this code line to unwrap since the standard value of the phasejump in my case is smaller than pi/2:
for v=1:k+1
%% X-Richtung
X_unwrap(:,:,v) = unwrap(2.*(X_phi(:,:,v)+pi/2),[],2)./2;
...
I hope i descirbed my problem well enough and if someone could help me I would appreciate it so much! It is for my master thesis.
  1 Commento
Adam Danz
Adam Danz il 4 Apr 2023
If you can attach your data, mainly X_unwrap and the plotting code, I'd be happy to take a closer look.

Accedi per commentare.

Risposte (1)

Abhijeet
Abhijeet il 4 Apr 2023
Hi,
It seems the unwrap function is not working properly. You can try the following to debug and solve the issue:
  1. Check the values of X_phi(:,:,v) for indices 2 and 3: One possible reason for the wrong unwrapping could be that the values of X_phi(:,:,2) and X_phi(:,:,3) are not within the expected range. You can check the values of X_phi(:,:,v) using the MATLAB "disp" function or by setting a breakpoint in the code and inspecting the values during runtime.
  2. Check the output of the unwrap function: The unwrap function can sometimes produce unexpected results, especially when the input values are not within the expected range. You can check the output of the unwrap function by using the MATLAB "disp" function.
  3. Use alternative unwrapping methods: If the issue persists, you can try using alternative unwrapping methods, such as the "unwrapToPi" or "unwrapToZero" functions in MATLAB.
I hope by following these steps you should be able to identify and fix any issues with the code and ensure that the unwrapping is performed correctly.

Prodotti


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by