Skip to content
Snippets Groups Projects
Commit e3c0da82 authored by Eric Kooistra's avatar Eric Kooistra
Browse files

Clarify SNR.

parent d6d617c7
No related branches found
No related tags found
1 merge request!419Resolve RTSD-265
...@@ -25,7 +25,7 @@ close all ...@@ -25,7 +25,7 @@ close all
rng('default') rng('default')
ImpulseResponse = 0; % set to 1 to calculate correction filter ImpulseResponse = 0; % set to 1 to calculate correction filter
Correct = 1; % set to 1 to allow correction filter to be applied Correct = 0; % set to 1 to allow correction filter to be applied
% cl is the prototype lowpass filter % cl is the prototype lowpass filter
Ncoefs = length(cl); % = 2304 Ncoefs = length(cl); % = 2304
...@@ -112,9 +112,13 @@ diff = outData - inData(1:length(outData)); ...@@ -112,9 +112,13 @@ diff = outData - inData(1:length(outData));
% . rng('default'); reconstruct, with Correct = 1: SNR = 62.24 dB % . rng('default'); reconstruct, with Correct = 1: SNR = 62.24 dB
% Note: % Note:
% . With the impulse data input the SNR = 304.46 dB, so perfect. % . With the impulse data input the SNR = 304.46 dB, so perfect.
% . For other input data there is still some error, due to the limited stopband % . For other input data there is still some error when Correct = 1, due to
% attenuation of the prototype LPF (can be seen using DEVS = 0.003 instead of % the limited stopband attenuation of the prototype LPF (can be seen using
% 0.0003 in Gen_filter12). % DEVS = 0.003 instead of 0.0003 in Gen_filter12).
% . When Correct = 0 then the error is caused largely by the passband ripple
% DEVP = 0.02 and W0 = 1 / 15.3 of the prototype LPF, and db(0.02) = -34 dB.
% With DEVP = 0.005 and W0 = 1 / 15.05 then db(0.005) = -46.0 dB and SNR =
% 38.8 dB, so increased.
SNR = 10 * log10(sum(abs(inData(10000:70000) .^ 2)) / sum(abs(diff(10000:70000) .^ 2))); SNR = 10 * log10(sum(abs(inData(10000:70000) .^ 2)) / sum(abs(diff(10000:70000) .^ 2)));
sprintf('SNR = %6.2f [dB]', SNR) sprintf('SNR = %6.2f [dB]', SNR)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment