Filter löschen
Filter löschen

How to compute SNR in dB for complex signals when noise is added in terms of standard deviation?

35 Ansichten (letzte 30 Tage)
How to calculate the SNR in dB, when noise is added in terms of standard deviation(std) for a complex signal in the code q1_Noise. And is there any matlab function that exactly does the same operation of adding noise to complex signals?
clear all; close all; clc;
fs=8192*2; % sampling frequency
dt = 1/fs; % sample time
T=8; % duration of the signal
Nt = T*fs; % total number of samples
t = 0:dt:T-dt; % time vector
f0 = 500;
fT = 4000;
finst = linspace(f0,fT, length(t)).';
phi = 2*pi*cumsum(finst)*dt;
% source 1
a1 = 1;
b1 = 6000;
c1 = 2;
c2 = 1.5;
A1 = ((a1 * exp(-b1 * (t - T/c1).^2 + 1j)));
q1 = A1.'.*exp(1j*phi);
% Add noise with variance = std^2
std = 0.01;
q1_Noise = q1 + std*(randn(Nt,1) + 1i*randn(Nt,1))/sqrt(2);
hold on
xlim([3.9 4.1])

Antworten (1)

vidyesh am 29 Nov. 2023
Bearbeitet: vidyesh am 29 Nov. 2023
Hi Kalasagarreddi,
It is my understanding that you want to know if there are any MATLAB functions to add noise to complex signals.
The ‘awgn’ function can be used to add White Gaussian noise to signal.
You can use the below code to add noise to a complex signal.
noisy_signal = awgn(complex_signal, snr, 'measured');
In this code, complex_signal’ is the original complex signal, ‘snr’ is the desired signal-to-noise ratio in decibels, and 'measured' indicates that the function should measure the power of the input signal and add noise to obtain the desired SNR.
Please refer to the following documentation to learn more about the ‘awgn’ function.
Hope this answer helps.

Community Treasure Hunt

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

Start Hunting!

Translated by