Hi everybody guys, I'm writing a signal processing software using C, so I'm a little bit "stuck".
I generated a triangular sampled signal. I need to add white gaussian noise to it at a certain SNR.
I calculated the power of autocorrelation as:
\[\frac{1}{N}\sum_{i=0}^{N-1}x^{2}\]
and then divided each element of the array with the sqrt of this power. So now the power of signal is 1.
Is conceptually right?
Then I generated a random array with 0 mean and 1 std.dev using Box Muller transformation. This has to become my noise array.
So I decided to make the same operation as above, to bring it to power 1. Then, I know that:
\[SNR_{dB}=\frac{Spower}{Npower}\] \[\Rightarrow\] \[ Npower=\frac{Spower}{10^{\frac{SNR}{10}}}\], with Spower=1.
Then I multiply each element of noise vector with the sqrt of this number.
The noisy correlation is the sum of this new vector and autocorrelated sampled vector.
Does it seems you legit? I made some conceptual error?