Unexpected behaviour with the unwrap() command

19 次查看(过去 30 天)
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 个评论
Adam Danz
Adam Danz 2023-4-4
If you can attach your data, mainly X_unwrap and the plotting code, I'd be happy to take a closer look.

请先登录,再进行评论。

回答(1 个)

Abhijeet
Abhijeet 2023-4-4
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.

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by