1
$\begingroup$

I'm using 'awgn(input_signal,snr_db,'measured')' function in MATLAB to add white noise to the input signal.
Here is the simplified script. Does zero padding the input signal affect the behavior of awgn function?

clc;clear all;close all;

data = randi([0 3], 1, 2^12); % Generate data
qam_mod = qammod(data, 4);  % Modulate data
qam_mod_u = upsample(qam_mod,64); % Upsample

ch_out_interplt = awgn(qam_mod_u, 5, 'measured');
ch_out_no_interplt = awgn(qam_mod, 5, 'measured');

ch_out_downsample = downsample(ch_out_interplt,64); % Downsample

scatterplot(ch_out_downsample); title('with up, down sampling, 5 dB SNR');
scatterplot(ch_out_no_interplt); title('no up, down sampling, 5 dB SNR');

The scatterplots are different with and without zero padding.

  1. Does that mean awgn function behavior depends on the zero padding (length of the signal)?
  2. How does the 'awgn(input_signal,snr_db,'measured')' function calculates the input signal power?
  3. How to make the power calculation independent of the length of the input signal?
  4. Is there any better way to simulate the awgn noise in MATLAB?

QPSK signal after adding awgn noise, no interpolation

QPSK signal after adding awgn noise, with interpolation

$\endgroup$
2
$\begingroup$

Does that mean awgn function behavior depends on the zero padding (length of the signal)?

Yes, it does depend on the length of the signal.

How does the 'awgn(input_signal,snr_db,'measured')' function calculates the input signal power?

For an input signal of length $N$, $x[n]$, the awgn function calculates the power as $\frac{1}{N} \sum_{n=1}^N |x[n]|^2$.

How to make the power calculation independent of the length of the input signal?

The above definition defines $N$ as the length of the signal, including the zero valued samples. If you don't want to count those towards your signal length, then you needs to have an effective signal length $N_0$ that only counts non-zero samples.

sigPower = mean(abs(qam_mod_u(qam_mod_u ~= 0)).^2);
noisePower = sigPower/10^(SNRdB/10);
noise = sqrt(noisePower/2)*(randn(size(qam_mod_u)) + 1j*randn(size(qam_mod_u)));
ch_out_interplt = qam_mod_u + noise;

Is there any better way to simulate the awgn noise in MATLAB?

The awgn function is fine as long as you understand what it is doing. For situations when the signal is turning off and on, it might be easier to do the noise on your own for exactly the reason of your question. You can also make it easier by putting this all in your own function too.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.