LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

calculate phase from min and max

I am putting minimum and max values into a sine wave generator. Is there also a way to calculate phase from those two numbers? If I have 1 and 50, then 1 is 90deg. and 50 and 270deg. If I want them to start a a particular value I need to calculate the phase of the numbers in between the minumum and max. Is this possible? I will attach the vi also so you can better see what I am doing. Thanks for any help.
0 Kudos
Message 1 of 2
(2,546 Views)
First of all, the process you're describing will always generate a phase between 90 and 270.

Now to do what you want ot do in a somewhat brute force way is as follows:

1. Calculate the number of samples in your data between the the 90 degree point and the 270 degree point.
2. Because the number of degrees between 90 and 270 is 180, divide this number by 180 to calculate the number of degrees each sample in your waveform represents.
3. Threshold your input waveform (starting at the 90 degree point) to find the sample where that value occurs.
4. Divide this value by the number calculated in step 2. The result is the phase shift of the data value.

I have written an example showing one way to implement this functionality.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 2
(2,546 Views)