# How to find correlation between 3 signals

I have 3 signals, S1 S2 S3, with a same time domain and same time steps. I'm wondering if there is any correlation between these 3 signals. more specifically I want to know if it is possible to make Signal S3 by any combination of signals S1 and S2.

You need to process them jointly in pairs to get the correlation coefficients $$\rho_{13}=\frac{\mathsf{Cov}(S_1,S_3)}{\sqrt{\mathsf{Var}(S_1)\mathsf{Var}(S_3)}}$$ $$\rho_{23}=\frac{\mathsf{Cov}(S_2,S_3)}{\sqrt{\mathsf{Var}(S_2)\mathsf{Var}(S_3)}}$$ that represent the linear dependencies between $S_1$, $S_3$ and $S_2$, $S_3$, respectively. So when $|\rho_{xy}|$ is close to one, it indicates high linear dependency (and values close to zero mean small linear dependency).

That said, the problem you mentioned can be solved using a least squares approximation. In MATLAB, assuming your signals are in form of column vectors S1, S2, and S3, you can do this to find the weights:

w = [S1 S2]\S3;


So the signal S3 can be approximated as

S3_hat = [S1 S2]*w;


and the mean squared approximation error is

mse_err = mse(S3-S3_hat);