0
$\begingroup$

I have implemented RLS algorithm using adaptive filter on TMS320C6713 DSK.I want to calculate the signal to noise ratio.

In this forum I found a method that I should input a speech signal with a silence portions in between. From the output of the adaptive filter I took sample of the silence considering it as a residual noise and the speech part considering it as (speech+ residual noise).

And then calculated SNR in MATLAB as follows:

snr=mse(output_speech)-mse(residual_noise)/mse(residual_noise);
snr_db=10*log10(snr);

If I calculate using this formula I get $40\textrm{ dB}$ improvement.Is this a correct way to calculate SNR?

Second method that I found on this forum was:

residual_noise = mse(output)-mse(input_speech);
snr_after = mse(speech) /residual_noise; 
snr_after_db = 10 * log10( snr_after);

with the second method I had to normalize the two signals. I made the max amplitude of both signals look same using MATLAB:

output=output*(max(input)/max(output));

Is this a corect way to normalize it? Using this normalization and formula I got SNR improvement of $10\textrm{ dB}$.

I aligned the signal using MATLAB's scorer function, but still I see some misalignment.

I am really confused which method to use and how can I verify it. Kindly please help.

$\endgroup$
2
$\begingroup$

I have a suggestion for you.

  1. Compute the mean power of the signal at the input of the filter without any signal applied at the input. You should only receive noise. This will be the noise power $ P_{N} $.
  2. Compute the mean power of the signal at the input of your filter when you apply your signal. You should have there your signal plus noise. Then, this will be the power of your signal plus noise $ P_{S+N} $.
  3. Compute your signal power by $ P_{S} = P_{S+N} - P_{N} $.
  4. Compute the ratio $ SNR = P_{S}/P_{N} $ and convert to dB if necessary.

It is very similar to the first method that you exposed. In your method, I have not understood the meaning of mse, but if is the mean squared error, you need to take care. The correct way to compute the power of a signal $ x $ from $ N $ samples is:

$$ P_{x} = \frac{1}{N} \sum_{n=0}^{N-1} |x(n)|^{2} $$

$\endgroup$
  • $\begingroup$ Ok,I will correct the formula .I have tried this method earlier and got an improvement of 40 dB.But I was confused if I can apply this method for adaptive filters cause the filter characteristics are different when only input signal is applied and when only noise signal is applied.If I give only the speech,the output of the adaptive filter y(n) is zero.So the filter characterstics are totally different in both cases(with speech signal and with noise signal ).Am I wrong anywhere ? $\endgroup$ – Abhishek Vazrekar Aug 11 '16 at 14:51
  • $\begingroup$ In youir code, you should use: snr=(mse(output_speech)-mse(residual_noise))/mse(residual_noise); so that not only the second term is divided. $\endgroup$ – JohnMarvin Aug 11 '16 at 22:58
  • $\begingroup$ Do you only have access to the signal in the output of the filter? Don't you have access to the signal at the input of the filter? You should make this measurements at the input of your filter. I updated my answer explaining this better. $\endgroup$ – JohnMarvin Aug 11 '16 at 23:06
  • $\begingroup$ I have acess to all input signals(speech and noise).I researched many papers none of them have mentioned this method of finding residual_noise.I need a reference before putting down in my paper.Can you please help me with that.One more thing why calculation of snr fail in 1st method.Even if I align them manually still problem exists. $\endgroup$ – Abhishek Vazrekar Aug 12 '16 at 14:41
  • $\begingroup$ The method I mentioned is to calculate SNR, not the residual noise. You did not mention that you wanted to find the residual noise. For SNR, there is no problem if your signals are not aligned. $\endgroup$ – JohnMarvin Aug 12 '16 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.