Is it possible to find the amount of noise or SNR of a signal from its time series output? For example; let x = randn(100,1) and y = awgn(signal,-5,'measured'); be two signals. Here signal is an unknown source signal of length 10,000 data points.

In Matlab this is what I did: snr(x) = 0.5177 and snr(y) = -34.3797 dB Shouldn't I get -5 dB as SNR?

I am unable to understand what these values convey as they are a ratio: How is 0.5177 coming? Since I am generating y with an SNR of -5 dB, so snr(y) should be -5 dB. Please help in clarifying if these answers are right and how to make sense of it.

  • $\begingroup$ Try reading the MATLAB docs: mathworks.com/help/signal/ref/snr.html. Then you’ll understand if you want $-5$ dB to be the answer then you should do snr(y, noise) $\endgroup$
    – Engineer
    Mar 31 '20 at 23:54
  • $\begingroup$ Thank you! What is the correct way to call y? Can I say y is a noise corrupted signal at SNR = -5 dB? $\endgroup$
    – Sm1
    Apr 1 '20 at 0:00
  • $\begingroup$ Yeah I'm assuming that y = signal + noise $\endgroup$
    – Engineer
    Apr 1 '20 at 0:02
  • $\begingroup$ Ok, but about x signal which is not added with any other signal. How do I find out its noise or SNR level? $\endgroup$
    – Sm1
    Apr 1 '20 at 0:04
  • $\begingroup$ I thought x is the noise-less signal...you're saying that x has noise added to it too? $\endgroup$
    – Engineer
    Apr 1 '20 at 0:05

I just don't think you're thinking this through all the way, and using the toolbox in MATLAB before you understand the basics. SNR is signal-to-noise ratio and is defined as $\text{SNR}=\frac{\text{Signal Power}}{\text{Noise Power}}$. When you call snr(signal, noise) in MATLAB, all it is doing is calculating the signal power, mean(abs(signal).^2), and the noise power, mean(abs(noise).^2), taking the ratio of them and returning the result in decibels (dB).

In the comments you are asking about how to calculate the SNR of x (the noiseless signal)...well its dividing by zero because the noise power in a noiseless signal is zero. You'd be doing $\frac{\text{Signal Power}}{0}=\infty$, you can go ahead and try using the snr function by doing snr(signal, zeros(size(signal))) but I'm willing to bet it either returns Inf or gives an error.

Note: Read the MATLAB docs on snr(signal) and you'll realize it is probably not returning what you expect. Docs are here: https://uk.mathworks.com/help/signal/ref/snr.html


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.