Computer Science, asked by geta9213, 1 year ago

Caluculating snr in case a noisy signal and original signal is given in python

Answers

Answered by rutu53
0
If you can get input signal when it doesn't contain any useful signal (I mean only noise is presented), you can estimate average noise power at first. Simply find a power of such a signal:

Pn= 1/N⋅∑k=0N−1|s(k)|2Pn=1/N⋅∑k=0N−1|s(k)|2.

Choose NN in 212…215212…215 range for example.

Then you can measure a power of signal+noisesignal+noise mixture, PsPs, by the same way, when input signal is presented at the input. Caution: the measurement of PsPs is only valid if the signal exists all the measurement time. SNR could be calculated by:

SNR=10⋅log10Ps−PnPnSNR=10⋅log10⁡Ps−PnPn.

If your noise is stationary and white it's possible to measure it once in the setup and use PnPn as a constant.

If you can't measure noise power at any reason, you can try to estimate SNR in the frequency domain via FFT. But you have to know your signal's band. The point is the same but you should use FFT frequency indexes instead of sample numbers kk while estimating integral power. PsPsis now power of signal+noisesignal+noise in the band of interest, while PnPn is the noise power in total band (0...fs0...fs). In this case power spectral density of the noise in your system should be evaluated at first. This method could be far too complex for your task.

Both methods show you pointless result in the case of low SNR in the signal band (not total band in general). Frequency domain method will be preferable if your signal's band is quite less than fsfs, otherwise time domain method will be good enough. To estimate SNR of the order of 5 dB or lower it's better to know signal and noise power (or power spectral density) a priory. So the task has robust analitical solution.

Hope this helps.

Similar questions