How do i find the snr of a signal, before filtering and after filtering?

42 views (last 30 days)
How do i find the snr of a signal before and after filtering it? I don't have any reference clean signal of it. The 'snr' function in matlab where snr(x,y) is used to find the snr, x denotes the signal and y denotes the noise. In my case, I have two signals, noisy (raw) signal and a filtered signal that has been obtained by filtering. So, what would be the 'x' and what would be the 'y' in both, before and after filtering has been done?
Thank you.

Answers (1)

William Rose
William Rose on 14 May 2023
Edited: William Rose on 15 May 2023
[edit: change SNR calculations from ratio of amplitudes to ratio of powers]
It depends. First of all, SNR is dimensionless, so the ratio must be of things with the same units.
I understand that you want to calculate the SNR of the unfiltered signal and the SNR of the filtered signal. One fairly common way to calculate SNR is to take the ratio of the power of the signal - which the investigator determines, based on their understanding of the signal - to the variance of the signal when "nothing is happening", or when the input is zero.
Example 1
The recording above (Lawrence, Yue, Rose, Marban) shows current through a calcium channel. The channel makes two brief openings (seen as negative deflections in the current) near the start of the recording period. The signal power is the square of the difference between the two red lines, and the noise is the variance in the flat section.
Example 2
The figure shows vertical ground reaction force of a runner on a treadmill, before and after 50 Hz lowpass Butterworth filtering. The filtered signal has been offset upwards by 200 N for visibility. The force is approximately zero when the runner is not in contact with the ground. The signal power is the square of the difference between zero and the peak. The noise is the variance of the signal in one of the "zero" segments. The signal powers for the unfiltered and filtered signals are about the same, in this example, since the filtering does not affect the baseline level or the peak level very much. But the noise is quite different before and after filtering, so the two SNRs will be different.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!