There are two real signals in the form of $A_i sin(wt+p_i), i=1,2$. Suppose frequency $w$ of both the signals is the same and amplitude $A_i$ and phase $p_i$ are different. The first signal has unknown $A$ and $p$, but they are constant in the time of observation (for simplicity only, actually they aren't). The second signal is under control. We only have it's difference $x(t) = s_1(t)-s_2(t)$. Some iterative algorithm is needed to minimize power of $x(t)$. So $x(t)$ is available input and $A_2(t)$, $p_2(t)$ are parameters under control.
The question is: is it some robust and rapid algorithm for jointly control both amplitude and phase to minimize power of $x(t)$? My idea was to implement complex gradient method: phase and amplitude at each step are represented as a complex number $C(t)$. Signal $s_2(t)$ can be set as $Re[C(t) exp(iwt)]$. But I can't understand how to define cost function and gradient in this case and also this approach seems to be computationally redundant. Any ideas?
Thanks in advance!