how to calculate SNR?

조회 수: 5 (최근 30일)
hafis radzi
hafis radzi 2019년 4월 14일
편집: Anudeep Kumar 2025년 6월 4일
HELLO,i had some question.i have do some some filtering FFT using a matlab program.but,i need to compared the original signal,noise signal,and filtering signal based on SNR.but i dont understand how to calculate the snr ratio.pls help me or give a suggestion method how to compare and analysis the signal.tq

답변 (1개)

Anudeep Kumar
Anudeep Kumar 2025년 6월 4일
편집: Anudeep Kumar 2025년 6월 4일
Hey hafis,
You can use MATLAB's inbuilt 'snr' function.
snr(x,y) returns the signal-to-noise ratio (SNR) in decibels of a signal x by computing the ratio of its summed squared magnitude to that of the noise y:
Assuming we have :
  • original_signal: the clean signal (without noise)
  • noisy_signal: the signal with added noise
  • filtered_signal: the result after applying your filter
snr_value = snr(original_signal, noisy_signal - original_signal);
In addition to this you can also manually calculate SNR using the formula
signal_power = mean(original_signal.^2);
noise_power = mean((noisy_signal - original_signal).^2);
snr_value = 10 * log10(signal_power / noise_power);
If we want to evaluate how well the filter worked:
noise_after_filter = filtered_signal - original_signal;
snr_filtered = 10 * log10(mean(original_signal.^2) / mean(noise_after_filter.^2));
I have attached the documentation of 'snr' for your reference.
Hope it helps!

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by