MATLAB - Signal Noise Ratio
Show older comments
I have a damped sine wave which is a emitted signal as below:
x = x = A*exp(-t).*sin(2*pi*f*t);
And I define a received signal, so that
y(n)=ax(n-k)+b(n), where a is the attenuation coefficient and k is a delay.
Then I calculate the cross-correlation between them
[xc,lags] = xcorr(y,x);
- How can I estimate the delay k for different SNR (Signal-Noise-Ratio) in dB
- How to represent the curve delay vs. SNR.
Answers (1)
To estimate the delay ( k ) in a received signal that is a noisy, attenuated, and delayed version of a damped sine wave, we can generate the emitted signal, which is a damped sine wave and define the signal as follows:
A = 1;
f = 5;
t = 0:0.001:1;
x = A * exp(-t) .* sin(2 * pi * f * t);
Next, we'll simulate the received signal. This signal will be an attenuated and delayed version of the emitted signal, with added noise. We can vary the noise level according to the Signal-to-Noise Ratio (SNR):
a = 0.8;
k = 50;
SNR_values = 0:5:30;
Now, for each SNR value, we can add noise to the received signal and calculate the cross-correlation between the emitted and received signals. This will help us estimate the delay:
estimated_delays = zeros(size(SNR_values));
for idx = 1:length(SNR_values)
SNR = SNR_values(idx);
noise_power = var(x) / (10^(SNR/10));
noise = sqrt(noise_power) * randn(size(x));
y = [zeros(1, k), a*x(1:end-k)] + noise;
[xc, lags] = xcorr(y, x);
[~, I] = max(xc);
estimated_delays(idx) = lags(I);
end
Finally, we can plot the estimated delay against the SNR to visualize how noise impacts delay estimation.
figure;
plot(SNR_values, estimated_delays, '-o');
xlabel('SNR (dB)');
ylabel('Estimated Delay (samples)');
title('Estimated Delay vs. SNR');
grid on;
Hope this resolves your query !
Categories
Find more on Smoothing and Denoising in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!