07-17-2009 10:59 AM
I have sine and cosine signals. The tangent and arctangent are used to get the -90 to 90 degree. To achieve the 360 degree display, I will use the absolute value and additional degree, such as 90 180 and 270. I have created the case and select parts, but I don't know how to link this two. Please Help!
Thanks!
Solved! Go to Solution.
07-17-2009 01:17 PM
07-17-2009 01:47 PM
Hi, I have a resolver(position sensor) which give me the sine and cosine signals. I need to convert these electrical signals into position which indicated the real position in spatial. In real condition, these signals are repeating every cycle. In the attachment, these sine and cosine signals are replaced by signal generators. I do not mind other program as long as it functional. I'm new for LabView. The attachment just an idea, it seems wrong. But my idea is to use tan(x)=[sin(x)/cos(x)]. Than this can be converted into atan(y). The atan(y) only can indicated -90 to 90 degree. So I use |atan(y)| and the justification of sin(x) and cos(x). The position can be found with the value of sin(x) and cos(x). For example, if |atan(y)|= 30 and sin(x) >0; con(x)<0, than I will know the position is 90+30=120, or if |atan(y)|= 30 and sin(x) <0; con(x)<0, than I will know the position is 180+30=210. So could you give me some suggestion? Thank you!
07-17-2009 02:06 PM
Look into the atan2 function. This takes X and Y as input and gives you the angle between -pi and pi.
-Darin
07-17-2009 02:43 PM
Thanks Darin.K! It's wonderful.
By the way, I do appreciate, if any one can give me some suggestion of how to use the case function. I use matlab a lot, so my mind is still stay in that stage, because I can use if/ case function to do this. But I do feel straggle to wire different units in LabView. Many thanks!
07-17-2009 03:15 PM
Since you were kind enough to thank me, here is a little vi that calculates the angle in a few different ways. If the atan2 function didn't exist, you could also use the re/im to mag/phase function as I show. I also fixed the atan result using a case structure and a selection.
-Darin