SNR, signal Recovery, MSE, SINAD without toolbox

4 views (last 30 days)
Hi, I am trying to calculate SNR, Signal Recovery, MSE, SINAD without toolbox without toolbox because I need to translate it into different programming languange. But when I tried to run the program there's no error but the result is odd, so I wonder if I write my code correctly.
%original_signal is a 64 x 1 double matrix
%recovery_signal is a 64 x 1 double matrix
SNR
%----Calculating SNR------%
num_snr = original_signal.^2;
den_snr = (original_Signal - recovery_signal).^2;
def_snr = 10 * (log10 (sum (num_snr) / sum (den_snr)));
fprintf('SNR: %f\n', def_snr);
Signal Recovery
%----Calculating Signal Recovery----%
num_err = norm(original_signal);
den_err = norm(original_singal - recovery_signal);
def_error= num_err / den_err;
fprintf( 'Signal recovery: %f \n', def_error);
MSE
%----Calculatin MSE-----%
num_mse = (original_signal - recovery_signal).^2;
def_mse = sum(num_mse) / numel (num_mse);
fprintf('MSE: %f\n', def_mse);
SINAD
%----Calculating SINAD----%
num_sinad = norm(original_signal);
def_signal = norm(original_signal - recovery_signal);
def_sndr= 20 * (log10 (num_sinad / def_signal));
fprintf( 'SNDR: %f\n', def_sndr);
original signal
recoverysignal
references:

Answers (0)

Community Treasure Hunt

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

Start Hunting!