# Measuring angle between 2 signals

I am working on a resonant converter, I want to measure the angle between the output voltage and the resonant current. I also want to observe the changes in angle when the switching frequency varies from 50kHz to 250kHz.

Hi Janki,

I want to better understand your question, are you looking to determine the phase difference?

it seems like you want to do a frequency response of the open loop plant. To do this you can use our AC sweep element and inject into your frequency reference. The amplitude and phase measurement is automatically handled when you use the AC sweep block.

If you want to do this measurement manually, do you need it as a simulation parameter or can you compute it after from the results?

Hi Janki,

An algorithm for doing this calculation used by Ridleyworks

angle = atan2(Bim, Bre) - atan2(Aim, Are)

Where A and B are the signals of interest.

Are = AVG((v(a)-aavg)cos(360timefreq))
Aim = AVG(-(v(a)-aavg)sin(360time
freq))

You need an integer number of cycles for A, and you need to “average” them to find aavg from above.