Jul 9, 2010 #1 S sweethomela8 Member level 4 Joined Apr 28, 2010 Messages 70 Helped 1 Reputation 2 Reaction score 0 Trophy points 1,286 Activity points 1,766 I'm trying to calculate the phase of a signal by digitizing the inphase and quadrature parts and then doing an digital ARCTAN(Q/I) function on it. My question is, what happens when the inphase component=0? and is there anything you can do about it. Thanks.
I'm trying to calculate the phase of a signal by digitizing the inphase and quadrature parts and then doing an digital ARCTAN(Q/I) function on it. My question is, what happens when the inphase component=0? and is there anything you can do about it. Thanks.
Jul 9, 2010 #2 FvM Super Moderator Staff member Joined Jan 22, 2008 Messages 52,513 Helped 14,758 Reputation 29,798 Reaction score 14,128 Trophy points 1,393 Location Bochum, Germany Activity points 298,482 Standard C has a function atan2() fot this purpose.
Jul 10, 2010 #3 Z zorx Member level 2 Joined Feb 15, 2010 Messages 45 Helped 8 Reputation 16 Reaction score 3 Trophy points 1,288 Location Spain Activity points 1,635 You can always do the check (I wrote it in pseudocode): if (I = 0) then angle = 90 else angle = arctan(Q/I)
You can always do the check (I wrote it in pseudocode): if (I = 0) then angle = 90 else angle = arctan(Q/I)
Jul 10, 2010 #4 FvM Super Moderator Staff member Joined Jan 22, 2008 Messages 52,513 Helped 14,758 Reputation 29,798 Reaction score 14,128 Trophy points 1,393 Location Bochum, Germany Activity points 298,482 I !=0 doesn't actually guarantee that Q/I is a valid float value. That's one reason why atan2() is provided by most C compiler math libraries.
I !=0 doesn't actually guarantee that Q/I is a valid float value. That's one reason why atan2() is provided by most C compiler math libraries.