0
$\begingroup$

enter image description hereI am working on a problem where the pressure profile is supposed to be smooth. But when I take a log of a certain complex numbers, MATLAB assumes the angle to be from pi to negative pi (clockwise direction)(I guess due to the principal branch being at 0). I am plotting contours and this is causing big discontinuity in my plots. Example

A = log (-(var_z-za2)) where var_z = [20.0 + 0.6i, 20.0 - 0.6i]

za2 =-2.5000 + 0.5000i yields A = [3.11 - 3.13i, 3.11 + 3.091i]

but if we assume the the domain is from 0 to 2pi, counterclockwise direction the same value yields (so no negative angle).

[3.11 + 3.14i, 3.11 + 3.09i]

This is logical and makes more sense in my situation as it would prevent the pressure profiles from rapidly jumping up. Is there anyway to force matlab to use 0 to 2pi for the radians? I would manually ask the code to ignore the point 0 so as to avoid singularity.

$\endgroup$
  • $\begingroup$ Replace $\log(z)$ by $\log(z)+i \pi\ 1_{\Im(z) < 0}$. The more general problem is called "phase unwrapping". $\endgroup$ – reuns Nov 16 '17 at 0:20
  • $\begingroup$ Could you explain it more please? I have meshed the complex plane and i have 4 other log variables. At one time not all of them are in -pi region. I was thinking of selectively adding 2pi to the ones that are negative. Will that cause problems? $\endgroup$ – John Joe Nov 16 '17 at 0:26
  • $\begingroup$ I can't see what you really mean, show us a plot of $\Im (\log f(z))$ to see how hard/easy will be the phase unwrapping. $\endgroup$ – reuns Nov 16 '17 at 0:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.