LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to achieve 360 degree display using arctangent by case structure?

Solved!
Go to solution

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!

0 Kudos
Message 1 of 6
(5,333 Views)
I may be able to answer the question if I could figure out what you're trying to do. What are you trying to create? A Lissajous graph?
0 Kudos
Message 2 of 6
(5,313 Views)

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!

0 Kudos
Message 3 of 6
(5,309 Views)
Solution
Accepted by topic author spwm

Look into the atan2 function.  This takes X and Y as input and gives you the angle between -pi and pi.

 

-Darin

Message 4 of 6
(5,298 Views)

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!

   

0 Kudos
Message 5 of 6
(5,291 Views)

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

Message 6 of 6
(5,280 Views)