How to calculate SNR of an exponential sine sweep?

3 次查看(过去 30 天)
I have an exponential sine sweep and I want to calculate its SNR. How can this be done
  2 个评论
Dimitris Kalogiros
Dimitris Kalogiros 2018-7-26
Hi Trishita.
I think you have to give some more info about your problem.
TRISHITA BANERJEE
TRISHITA BANERJEE 2018-7-26
%Testing using both interleaved and overlapped signal
% close all clear all; clc
fs = 44100;
e=3; % no of interleaved system
K=3; % no of harmonic impulse response
f_start = 55;%553
f_end = fs/2;%24100; %Possible values 20k and 24k
T =3;
A = 0.04;%0.025; for 0.6m%0.6;%for 1m distance%0.7;%for1.5m
L1 =9350; % for -70 db
L2 =2250; % for -70 db
W1=2*pi*f_start/fs;
W2=2*pi*f_end/fs;
tau_2=15300;
T_1 =(((e-1)*L1)+L2).*log(W2/W1)./log(2);
tau_k= T_1/log(W2/W1).*log(K);
siglen_MESM = T_1;
x_m = A*sin(W1*siglen_MESM/log(W2/W1).*(exp(((0:siglen_MESM)./siglen_MESM)*log(W2/W1))-1)); %Multiple Sine Sweep
% t_i = ceil(L1*fs); % t_o = ceil((T_1/log(W2/W1)).*log(K)*fs); % t_i = ceil(L1); % t_o = ceil(L1+ tau_k ); imax=5; t = delay (imax, L1 ,L2, tau_k, tau_2); t_max=max(t);
x = zeros(length(x_m)+t_max+fs,imax);
for n = 1:imax
x(:,n) = [zeros(t(n)+fs,1);x_m';zeros(t_max -t(n),1)];
end
x1 = x(:,1);
x2 = x(:,2);
x3 = x(:,3);
x4 = x(:,4);
x5 = x(:,5);
y_m = x1+x2+x3+x4+x5;% Simulated Measurement
y_m=y_m';
%Testing using both interleaved and overlapped signal
% close all clear all; clc
fs = 44100;
e=3; % no of interleaved system
K=3; % no of harmonic impulse response
f_start = 55;%553
f_end = fs/2;%24100; %Possible values 20k and 24k
T =3;
A = 0.04;%0.025; for 0.6m%0.6;%for 1m distance%0.7;%for1.5m
L1 =9350; % for -70 db
L2 =2250; % for -70 db
W1=2*pi*f_start/fs;
W2=2*pi*f_end/fs;
tau_2=15300;
T_1 =(((e-1)*L1)+L2).*log(W2/W1)./log(2);
tau_k= T_1/log(W2/W1).*log(K);
siglen_MESM = T_1;
x_m = A*sin(W1*siglen_MESM/log(W2/W1).*(exp(((0:siglen_MESM)./siglen_MESM)*log(W2/W1))-1)); %Multiple Sine Sweep
% t_i = ceil(L1*fs); % t_o = ceil((T_1/log(W2/W1)).*log(K)*fs); % t_i = ceil(L1); % t_o = ceil(L1+ tau_k ); imax=5; t = delay (imax, L1 ,L2, tau_k, tau_2); t_max=max(t);
x = zeros(length(x_m)+t_max+fs,imax);
for n = 1:imax
x(:,n) = [zeros(t(n)+fs,1);x_m';zeros(t_max -t(n),1)];
end
x1 = x(:,1);
x2 = x(:,2);
x3 = x(:,3);
x4 = x(:,4);
x5 = x(:,5);
y_m = x1+x2+x3+x4+x5;% Simulated Measurement
y_m=y_m';
xinv = fliplr(x_m) .* (W2/W1).^(-(0:siglen_MESM)/siglen_MESM); %Inverse sweep
f_t = f_start*exp(((0:siglen_MESM)./siglen_MESM)*log(W2/W1));
[h1, h2, h1_nl, h2_nl] = farina_deconvolution2(x_m,y_m,xinv,17.6584,1 );
figure subplot(2,1,1); spectrogram(h1,1024,1000,1024,fs,'yaxis'); title('Linear Impulse Response H1');ylabel('h1 \rightarrow dB') subplot(2,1,2); spectrogram(h2,1024,1000,1024,fs,'yaxis'); title('Linear Impulse Response H2');ylabel('h2 \rightarrow dB')
Here x_m is my desired signal...And when I calculate the h1 that is the impulse response of my signal i usually take the peaks above -70db.So I can consider anything above -70db is original signal and less than -70db is noise.. So how can I approach to find SNR of this system

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by