I need to change a graphic without using unwrap

1 次查看(过去 30 天)
Please I need a Matlab expert!!
I need this totally discontinuous graph to be transformed into a continuous graph like the one in the following figure, but without using the unwrap function that is built into Matlab. I need if you can guide me and show a code which will help me to achieve the continuity of the graph. It is very important not to use the unwrap function to achieve the goal. Thank you in advance
This is the graph or discontinuous function
I need to get to this graph or function without using the unwrap function

回答(1 个)

Jonas
Jonas 2022-6-29
you can unwrap manually. if you have data x and y
myWrapThr=-150;
dy=diff(y);
dy(dy<myWrapThr)=dy(dy<myWrapThr)+180;
newY=cumsum([y(1) dy]);
  2 个评论
Patricio Morales
Patricio Morales 2022-6-29
Could you explain the estimated code in a little more detail?
Why is myWrapthr -150?
Jonas
Jonas 2022-6-30
your aim is to remove the jump from approx. +90 to -90. This would equal of exactly -180. depending on the last point before the jump and the first after, the values could also be +86 and -88, then the difference would be only -174. the vatch this natural unprecision, i use a threshold of -150. You could also use -175 as threshold or -170. So my choosing was very generous ;)
this jump values are the corrected by 180 to remove the jump and then the vector is reformed using cumsum on the differental dy
note two things: at the moment the given code only removes jumps near -180 and not +180. But the code can be easily adjusted or expanded for such behavior.
the other point is the unwrapping itself: normally unwrapping is used for visual phase jumps of signals, but those are normally between +-180, or 360 in absolute terms. phases of +- 180 are the equal, but +-90 are not

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Image Segmentation and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by