I'm trying to simulate two frequency-domain signals with a desired coherence, and I'd like to check if my idea is right.
To simulate two time-domain signals with a desired correlation, we can use the following method:
Suppose $\Sigma$ is the desired correlation. Let $X \sim N(0,1)$.
Then if we take
$X_1 = \Sigma^{1/2} X$,
$X_1$ will have the desired correlation:
$\mathbb{E} [X_1 X_1^{\dagger}] = \mathbb{E}[\Sigma^{1/2} X (\Sigma^{1/2} X)^{\dagger}] \\ = \mathbb{E}[\Sigma^{1/2} X X^{\dagger} \Sigma^{1/2 \dagger}] \\ = \Sigma^{1/2} \mathbb{E} [X X^{\dagger}] \Sigma^{1/2} \\ = \Sigma $
I'm trying to extend this to the frequency domain, after applying a Fourier transform to $X$. Let $X^F$ be the Fourier transform of $X$, ie. $X^F = WX$ where $W$ is the DFT matrix. Let the desired coherence be $S$. To use an idea similar to that used to simulate a desired correlation, I choose
$X_1^F = S^{1/2} S_{XX}^{-1/2} X^F$
where $S_{XX}$ is the cross-spectrum of $X^F$. Then
$\mathbb{E}[X_1^F X_1^{F\dagger}] = S^{1/2} S_{XX}^{-1/2} \mathbb{E}[X^F X^{F\dagger}] S_{XX}^{-1/2 \dagger} S^{1/2 \dagger} \\ = S^{1/2} S_{XX}^{-1/2} S_{XX} S_{XX}^{-1/2} S^{1/2} \\ = S$
I wrote a Python program to try this out but I didn't get a coherence close to my desired $S$, so I'm hoping to check whether there are any conceptual errors (otherwise it might be a numerical issue?). In particular, I'm not sure if $S_{XX}^{-1/2}=S_{XX}^{-1/2 \dagger}$ in general.