Consider the following example Simulink (Download example) system:
Input is a magnitude and an ever increasing angle, which will return two sine, the real and imaginary part as expected:
Calculating the Magntitude from real and imaginary part is no issue. Getting the angle in the domain between -pi and pi neither:
But I'm really struggling in calculating the original angle from the imaginary and real part. Do you have any ideas how to get rid of the discontinuity (yellow line, last picture)?