How can I retrieve the original phase of this complex number in matlab?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












Suppose I enter a complex number, say
$$z = -2e^ipi/6$$



And, I have to get the phase of "z" as $[pi/6]$ only. But when I try to retrieve the phase using 'angle(z)' in matlab, it would display the phase as $[(pi/6)-pi]$. I understand the reason behind shift of angle "$pi$" and I don't want this to happen in my original phase. Please help me out on this problem.







share|cite|improve this question





















  • I believe you mean $2e^i fracpi6$
    – Ahmad Bazzi
    Jul 20 at 15:35











  • No, @AhmadBazzi it's -2
    – Yatish
    Jul 20 at 15:36










  • How is Matlab supposed to figure out from the number $(-sqrt3-i)$ that you originally specified it as $-2e^ipi/6$ and not as $2e^ipi/6-pi$ or as $2e^ipi/6+pi$?
    – celtschk
    Jul 20 at 15:40










  • @celtschk I get your point. What I want is- if I enter negative amplitude, it should store it as negative. On the contrary, matlab converts -1 to exp(ipi) or exp(-ipi). And, I don't want this.
    – Yatish
    Jul 20 at 15:45










  • @Yatish: If you need that extra information, you need to store it extra. Because in the number, there's no "space" to store it. Maybe you can store the square root of the number instead; then you can use the fact that a number has two square roots with opposite signs to store the extra sign information.
    – celtschk
    Jul 20 at 15:53














up vote
1
down vote

favorite












Suppose I enter a complex number, say
$$z = -2e^ipi/6$$



And, I have to get the phase of "z" as $[pi/6]$ only. But when I try to retrieve the phase using 'angle(z)' in matlab, it would display the phase as $[(pi/6)-pi]$. I understand the reason behind shift of angle "$pi$" and I don't want this to happen in my original phase. Please help me out on this problem.







share|cite|improve this question





















  • I believe you mean $2e^i fracpi6$
    – Ahmad Bazzi
    Jul 20 at 15:35











  • No, @AhmadBazzi it's -2
    – Yatish
    Jul 20 at 15:36










  • How is Matlab supposed to figure out from the number $(-sqrt3-i)$ that you originally specified it as $-2e^ipi/6$ and not as $2e^ipi/6-pi$ or as $2e^ipi/6+pi$?
    – celtschk
    Jul 20 at 15:40










  • @celtschk I get your point. What I want is- if I enter negative amplitude, it should store it as negative. On the contrary, matlab converts -1 to exp(ipi) or exp(-ipi). And, I don't want this.
    – Yatish
    Jul 20 at 15:45










  • @Yatish: If you need that extra information, you need to store it extra. Because in the number, there's no "space" to store it. Maybe you can store the square root of the number instead; then you can use the fact that a number has two square roots with opposite signs to store the extra sign information.
    – celtschk
    Jul 20 at 15:53












up vote
1
down vote

favorite









up vote
1
down vote

favorite











Suppose I enter a complex number, say
$$z = -2e^ipi/6$$



And, I have to get the phase of "z" as $[pi/6]$ only. But when I try to retrieve the phase using 'angle(z)' in matlab, it would display the phase as $[(pi/6)-pi]$. I understand the reason behind shift of angle "$pi$" and I don't want this to happen in my original phase. Please help me out on this problem.







share|cite|improve this question













Suppose I enter a complex number, say
$$z = -2e^ipi/6$$



And, I have to get the phase of "z" as $[pi/6]$ only. But when I try to retrieve the phase using 'angle(z)' in matlab, it would display the phase as $[(pi/6)-pi]$. I understand the reason behind shift of angle "$pi$" and I don't want this to happen in my original phase. Please help me out on this problem.









share|cite|improve this question












share|cite|improve this question




share|cite|improve this question








edited Jul 20 at 15:35









Isham

10.6k3829




10.6k3829









asked Jul 20 at 15:30









Yatish

115




115











  • I believe you mean $2e^i fracpi6$
    – Ahmad Bazzi
    Jul 20 at 15:35











  • No, @AhmadBazzi it's -2
    – Yatish
    Jul 20 at 15:36










  • How is Matlab supposed to figure out from the number $(-sqrt3-i)$ that you originally specified it as $-2e^ipi/6$ and not as $2e^ipi/6-pi$ or as $2e^ipi/6+pi$?
    – celtschk
    Jul 20 at 15:40










  • @celtschk I get your point. What I want is- if I enter negative amplitude, it should store it as negative. On the contrary, matlab converts -1 to exp(ipi) or exp(-ipi). And, I don't want this.
    – Yatish
    Jul 20 at 15:45










  • @Yatish: If you need that extra information, you need to store it extra. Because in the number, there's no "space" to store it. Maybe you can store the square root of the number instead; then you can use the fact that a number has two square roots with opposite signs to store the extra sign information.
    – celtschk
    Jul 20 at 15:53
















  • I believe you mean $2e^i fracpi6$
    – Ahmad Bazzi
    Jul 20 at 15:35











  • No, @AhmadBazzi it's -2
    – Yatish
    Jul 20 at 15:36










  • How is Matlab supposed to figure out from the number $(-sqrt3-i)$ that you originally specified it as $-2e^ipi/6$ and not as $2e^ipi/6-pi$ or as $2e^ipi/6+pi$?
    – celtschk
    Jul 20 at 15:40










  • @celtschk I get your point. What I want is- if I enter negative amplitude, it should store it as negative. On the contrary, matlab converts -1 to exp(ipi) or exp(-ipi). And, I don't want this.
    – Yatish
    Jul 20 at 15:45










  • @Yatish: If you need that extra information, you need to store it extra. Because in the number, there's no "space" to store it. Maybe you can store the square root of the number instead; then you can use the fact that a number has two square roots with opposite signs to store the extra sign information.
    – celtschk
    Jul 20 at 15:53















I believe you mean $2e^i fracpi6$
– Ahmad Bazzi
Jul 20 at 15:35





I believe you mean $2e^i fracpi6$
– Ahmad Bazzi
Jul 20 at 15:35













No, @AhmadBazzi it's -2
– Yatish
Jul 20 at 15:36




No, @AhmadBazzi it's -2
– Yatish
Jul 20 at 15:36












How is Matlab supposed to figure out from the number $(-sqrt3-i)$ that you originally specified it as $-2e^ipi/6$ and not as $2e^ipi/6-pi$ or as $2e^ipi/6+pi$?
– celtschk
Jul 20 at 15:40




How is Matlab supposed to figure out from the number $(-sqrt3-i)$ that you originally specified it as $-2e^ipi/6$ and not as $2e^ipi/6-pi$ or as $2e^ipi/6+pi$?
– celtschk
Jul 20 at 15:40












@celtschk I get your point. What I want is- if I enter negative amplitude, it should store it as negative. On the contrary, matlab converts -1 to exp(ipi) or exp(-ipi). And, I don't want this.
– Yatish
Jul 20 at 15:45




@celtschk I get your point. What I want is- if I enter negative amplitude, it should store it as negative. On the contrary, matlab converts -1 to exp(ipi) or exp(-ipi). And, I don't want this.
– Yatish
Jul 20 at 15:45












@Yatish: If you need that extra information, you need to store it extra. Because in the number, there's no "space" to store it. Maybe you can store the square root of the number instead; then you can use the fact that a number has two square roots with opposite signs to store the extra sign information.
– celtschk
Jul 20 at 15:53




@Yatish: If you need that extra information, you need to store it extra. Because in the number, there's no "space" to store it. Maybe you can store the square root of the number instead; then you can use the fact that a number has two square roots with opposite signs to store the extra sign information.
– celtschk
Jul 20 at 15:53










1 Answer
1






active

oldest

votes

















up vote
0
down vote













The correct polar form representation of a complex number is $z = re^itheta$ where
$r > 0$. Matlab, correctly, interpreted $-2e^i fracpi6$ as
$2e^i frac-5pi6$. If you want to use a nonstandard phase shift, then add $pi$ to any negative phase shifts.






share|cite|improve this answer





















  • But, what if I want to retrieve the number the way I had entered it? I want the minus sign with 2 instead of being converted to exp(ipi) or exp(-ipi).
    – Yatish
    Jul 20 at 15:52










  • In which quadrants do you get the wrong answer? How can you detect that? How can you fix it once you detect it?
    – steven gregory
    Jul 21 at 0:47










  • the angle entered in the phase part always lies between -pi and pi. Actually, it doesn't matter in which quadrant does the angle lie in the first place. If matlab finds a negative sign attached with the amplitude, the final angle is going to differ from the entered value by +pi or -pi in order to keep the amplitude positive.
    – Yatish
    Jul 21 at 13:40










  • @Yatish - Hint. $e^ipi=-1$, so $re^itheta = -re^i(pi + theta)$
    – steven gregory
    Jul 21 at 14:51











Your Answer




StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "69"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2857762%2fhow-can-i-retrieve-the-original-phase-of-this-complex-number-in-matlab%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













The correct polar form representation of a complex number is $z = re^itheta$ where
$r > 0$. Matlab, correctly, interpreted $-2e^i fracpi6$ as
$2e^i frac-5pi6$. If you want to use a nonstandard phase shift, then add $pi$ to any negative phase shifts.






share|cite|improve this answer





















  • But, what if I want to retrieve the number the way I had entered it? I want the minus sign with 2 instead of being converted to exp(ipi) or exp(-ipi).
    – Yatish
    Jul 20 at 15:52










  • In which quadrants do you get the wrong answer? How can you detect that? How can you fix it once you detect it?
    – steven gregory
    Jul 21 at 0:47










  • the angle entered in the phase part always lies between -pi and pi. Actually, it doesn't matter in which quadrant does the angle lie in the first place. If matlab finds a negative sign attached with the amplitude, the final angle is going to differ from the entered value by +pi or -pi in order to keep the amplitude positive.
    – Yatish
    Jul 21 at 13:40










  • @Yatish - Hint. $e^ipi=-1$, so $re^itheta = -re^i(pi + theta)$
    – steven gregory
    Jul 21 at 14:51















up vote
0
down vote













The correct polar form representation of a complex number is $z = re^itheta$ where
$r > 0$. Matlab, correctly, interpreted $-2e^i fracpi6$ as
$2e^i frac-5pi6$. If you want to use a nonstandard phase shift, then add $pi$ to any negative phase shifts.






share|cite|improve this answer





















  • But, what if I want to retrieve the number the way I had entered it? I want the minus sign with 2 instead of being converted to exp(ipi) or exp(-ipi).
    – Yatish
    Jul 20 at 15:52










  • In which quadrants do you get the wrong answer? How can you detect that? How can you fix it once you detect it?
    – steven gregory
    Jul 21 at 0:47










  • the angle entered in the phase part always lies between -pi and pi. Actually, it doesn't matter in which quadrant does the angle lie in the first place. If matlab finds a negative sign attached with the amplitude, the final angle is going to differ from the entered value by +pi or -pi in order to keep the amplitude positive.
    – Yatish
    Jul 21 at 13:40










  • @Yatish - Hint. $e^ipi=-1$, so $re^itheta = -re^i(pi + theta)$
    – steven gregory
    Jul 21 at 14:51













up vote
0
down vote










up vote
0
down vote









The correct polar form representation of a complex number is $z = re^itheta$ where
$r > 0$. Matlab, correctly, interpreted $-2e^i fracpi6$ as
$2e^i frac-5pi6$. If you want to use a nonstandard phase shift, then add $pi$ to any negative phase shifts.






share|cite|improve this answer













The correct polar form representation of a complex number is $z = re^itheta$ where
$r > 0$. Matlab, correctly, interpreted $-2e^i fracpi6$ as
$2e^i frac-5pi6$. If you want to use a nonstandard phase shift, then add $pi$ to any negative phase shifts.







share|cite|improve this answer













share|cite|improve this answer



share|cite|improve this answer











answered Jul 20 at 15:49









steven gregory

16.4k22055




16.4k22055











  • But, what if I want to retrieve the number the way I had entered it? I want the minus sign with 2 instead of being converted to exp(ipi) or exp(-ipi).
    – Yatish
    Jul 20 at 15:52










  • In which quadrants do you get the wrong answer? How can you detect that? How can you fix it once you detect it?
    – steven gregory
    Jul 21 at 0:47










  • the angle entered in the phase part always lies between -pi and pi. Actually, it doesn't matter in which quadrant does the angle lie in the first place. If matlab finds a negative sign attached with the amplitude, the final angle is going to differ from the entered value by +pi or -pi in order to keep the amplitude positive.
    – Yatish
    Jul 21 at 13:40










  • @Yatish - Hint. $e^ipi=-1$, so $re^itheta = -re^i(pi + theta)$
    – steven gregory
    Jul 21 at 14:51

















  • But, what if I want to retrieve the number the way I had entered it? I want the minus sign with 2 instead of being converted to exp(ipi) or exp(-ipi).
    – Yatish
    Jul 20 at 15:52










  • In which quadrants do you get the wrong answer? How can you detect that? How can you fix it once you detect it?
    – steven gregory
    Jul 21 at 0:47










  • the angle entered in the phase part always lies between -pi and pi. Actually, it doesn't matter in which quadrant does the angle lie in the first place. If matlab finds a negative sign attached with the amplitude, the final angle is going to differ from the entered value by +pi or -pi in order to keep the amplitude positive.
    – Yatish
    Jul 21 at 13:40










  • @Yatish - Hint. $e^ipi=-1$, so $re^itheta = -re^i(pi + theta)$
    – steven gregory
    Jul 21 at 14:51
















But, what if I want to retrieve the number the way I had entered it? I want the minus sign with 2 instead of being converted to exp(ipi) or exp(-ipi).
– Yatish
Jul 20 at 15:52




But, what if I want to retrieve the number the way I had entered it? I want the minus sign with 2 instead of being converted to exp(ipi) or exp(-ipi).
– Yatish
Jul 20 at 15:52












In which quadrants do you get the wrong answer? How can you detect that? How can you fix it once you detect it?
– steven gregory
Jul 21 at 0:47




In which quadrants do you get the wrong answer? How can you detect that? How can you fix it once you detect it?
– steven gregory
Jul 21 at 0:47












the angle entered in the phase part always lies between -pi and pi. Actually, it doesn't matter in which quadrant does the angle lie in the first place. If matlab finds a negative sign attached with the amplitude, the final angle is going to differ from the entered value by +pi or -pi in order to keep the amplitude positive.
– Yatish
Jul 21 at 13:40




the angle entered in the phase part always lies between -pi and pi. Actually, it doesn't matter in which quadrant does the angle lie in the first place. If matlab finds a negative sign attached with the amplitude, the final angle is going to differ from the entered value by +pi or -pi in order to keep the amplitude positive.
– Yatish
Jul 21 at 13:40












@Yatish - Hint. $e^ipi=-1$, so $re^itheta = -re^i(pi + theta)$
– steven gregory
Jul 21 at 14:51





@Yatish - Hint. $e^ipi=-1$, so $re^itheta = -re^i(pi + theta)$
– steven gregory
Jul 21 at 14:51













 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2857762%2fhow-can-i-retrieve-the-original-phase-of-this-complex-number-in-matlab%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What is the equation of a 3D cone with generalised tilt?

Color the edges and diagonals of a regular polygon

Relationship between determinant of matrix and determinant of adjoint?