2
$\begingroup$

I have a problem with jumping phase plots using the Arg function in mathematica. I have looked at the other questions already asked here (e.g., continuous phase/Arg function), but am lost when dealing with a 3D plot. Could anybody help me?

So this is the code:

beta[al_, al2_] := (al^2 + al2^2)^(1/2);
Mx[alpha_, ora_] := alpha*ora/beta[alpha, ora]^2*(4*Sin[beta[alpha, ora]]^2*Cos[beta[alpha, ora]]) - alpha*Sin[beta[alpha, ora]]/beta[alpha, ora]^3*(alpha^2*Cos[2*beta[alpha, ora]] + ora^2);
My[alpha_, ora_] := 2*alpha*Sin[beta[alpha, ora]]/beta[alpha, ora]^3*(ora^2*Cos[2*beta[alpha, ora]] + alpha^2*Cos[beta[alpha, ora]]) + alpha*ora/beta[alpha, ora]^4*(1 - Cos[beta[alpha, ora]])*(alpha^2*Cos[2*beta[alpha, ora]] + ora^2);
Mx2[alpha_, ora_] := -alpha*ora/beta[alpha, ora]^2*(4*Sin[beta[alpha, ora]]^2*Cos[beta[alpha, ora]]) - alpha*Sin[beta[alpha, ora]]/beta[alpha, ora]^3*(alpha^2*Cos[2*beta[alpha, ora]] + ora^2);
My2[alpha_, ora_] := -2*alpha*Sin[beta[alpha, ora]]/beta[alpha, ora]^3*(ora^2*Cos[2*beta[alpha, ora]] + alpha^2*Cos[beta[alpha, ora]]) + alpha*ora/beta[alpha, ora]^4*(1 - Cos[beta[alpha, ora]])*(alpha^2*Cos[2*beta[alpha, ora]] + ora^2);
Mxy[alpha_, ora_] := Mx[alpha, ora] + I*My[alpha, ora];
Mxy2[alpha_, ora_] := Mx2[alpha, ora] + I*My2[alpha, ora];
phi[alpha_, ora_] := Arg[Mxy2[alpha, ora]/Mxy[alpha, ora]];

Plot3D[phi[a, b], {a, 0, Pi}, {b, 0, -Pi/6}]

Then as expected the function is only defined in the range of [-Pi, Pi] due to the Arg function used is phi, therefore there are two jumps in this case. This is what I get

enter image description here

How can I make it continous from -2 Pi to 2 Pi on the z-Axis in this 3D plot. Any ideas?

$\endgroup$
1

1 Answer 1

2
$\begingroup$

The simplest approach that I found: choose the center (a0,b0) somewhere in the middle of the plot range and track phase jumps from the center (a0,b0) to any point (a,b) by calculating n points between

a0 = 1.5;
b0 = 0.;
n = 10;
phi2[a_, b_] := Fold[# + Mod[#2 - #, 2 π, -π] &, phi[a0, b0], 
   Table[phi[a0 + (a - a0) t/n, b0 + (b - b0) t/n], {t, n}]];
Plot3D[phi2[a, b], {a, 0, Pi}, {b, 0, -Pi/6}]

enter image description here

Phase jumps:

Plot3D[phi2[a, b] - phi[a, b], {a, 0, Pi}, {b, 0, -Pi/6}, NormalsFunction -> None]

enter image description here

$\endgroup$
1
  • $\begingroup$ Great, exactly what I needed! $\endgroup$
    – SiGo
    Commented Sep 18, 2014 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.