# Method to extract a phase between input and output of a nonlinear system

I have a nonlinear (blackbox) system which gets a singular frequency (f) signal as input:

input = A*sin(2*pi*f) + B


And I get an output signal, which has oscillations + unknown trend that looks like this:

My question is what would be the best way to extract the phase between the two signals? Are there specific methods for extraction of phase in nonlinear systems? In the case of detrending the output, is there a robust method to do it that ensures not altering the phase while detrending?

I hope this is the right place for this question, if not I will take it somewhere else.

• Does it make any sense to ask about phase difference if the system is non-linear? If given a sinusoidal input of frequency $\omega$, some non-linear systems will give an output of frequency $n \omega$. Do you know something about the non-linearity that leads you to assume the output will have the same frequency content as the input?
– Peter K.
Commented Dec 6, 2023 at 0:30
• I do know that the output will carry the same dominant frequency f (plus noise coming from the trend), and I'm looking for the phase of that frequency f. It makes sense because I want to compare the phases between different outputs when changing the amplitude of the input. Commented Dec 6, 2023 at 0:50
• Could phase cancellation work in this? Commented Dec 6, 2023 at 8:04