Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
Hi,
A friend asked me for a phase diagram of a transfer function (see photo and file). I distractedly used the arg(Im(W (iω))/Re(W(iω))) operator for the phase graph. I know this is an old problem, this graph was actually incorrect as seen from the comparison with the correct graph of the function φ1. Why does this happen?
The real part of X01 is always negative. So I would expect angles in the range [pi/2; pi] or [-pi/2,-pi[ for the phase.
The atan function never would give you these values (its restricted to [-pi/2; pi/2]). You would have to use atan2.
It seems to me that even with atan2, nothing changes:
@-MFra- wrote:
It seems to me that even with atan2, nothing changes:
Correct. This is because both arg and atan2 give you the correct results and I think your phi1 is wrong (phase shifted by pi).
When you calculated (symbolically) Im(X1)/Re(X2) the denominator was cancelled and the result was (b-w^2)/(a*w). This was the place where you lost the signs of the real- and imaginary parts. The real part ALWAYS is negtive and so the phase can't be anything in the range (-pi/2; pi).
atan2 and also the arg function always return values in the range ]-pi; pi]. This is the reason for the jump when w^2=b at w=4.47 when the phase is +- pi (and not 0!)
You may consider creating your own arg or arctan function which instead always returns values in the range [0; 2pi[ to avoid that jump.
I used the modulo function to do the job but you could as well use an if statement or the if function to achieve the same effect. In case you'd prefer negative phase angles, you would replace the +2 pi by - 2pi.