# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution
Highlighted

## use location of highest amplitude as index to find phase angle (FFT)

Hello, I did an FFT-Analysis on two signals (one voltage and one current) and used the peak detector on both signals to detect the location of the highest amplitude in order to get the corresponding phase angle.

My goal is to find the phase difference between the two signals, so Phase Diff = Phase Current - Phase Voltage, this method works (as proven when i compare the results with other methods shown in VI).

My question is, is there any way to connect the location of the highest amplitude to the index of the array used to detect my phase angle? So far I have to run my vi twice, first to get the locations, then only I could write it as the index of my array to get the correct phase angle.

Seems ridiculous to me that I have to run it twice, there must be a way to directly connect it?

Any help would be appreciated!

Vi as attached.

Message 1 of 3
(125 Views)
Solution
Accepted by topic author Jun_l

## Re: use location of highest amplitude as index to find phase angle (FFT)

That does sound ridiculous. I'm sure it's not true 🙂

Do you want to take the values in Location (U) and Location (I) and then use those to index your phase outputs (i.e. the constant "1" values in your attached VI?)?

If so, you're already done - you only need to round your "Location" value of choice (you could use the Array Max and Min function, which provides indices too) to get an integer from a double interpolated index, and then use it to get the phases as you already are with Index Array.

If not, I'm afraid I missed the point, but I'm still sure you won't have to run the same VI twice to get the behaviour you want.

Message 2 of 3
(108 Views)

## Re: use location of highest amplitude as index to find phase angle (FFT)

Hi cbutcher,

your solution worked! Thanks for the tip!

Message 3 of 3
(74 Views)