| Communications Toolbox | ![]() |
Adding Noise
According to the definition of baseband QASK modulation, modsignal is a complex matrix having len*Fs/Fd rows and two columns. The command below adds normally distributed random numbers to the real and imaginary parts of modsignal, to produce a noisy signal noisy. The randn function is a built-in MATLAB function.
Notice that the command adds to modsignal an entire real matrix of the appropriate size and an entire imaginary matrix of the appropriate size. Using a loop to add noise to individual scalar entries of modsignal would be less efficient, because MATLAB is optimized for matrix operations.
% Add noise to real and imaginary parts of the modulated signal. noisy = modsignal+.5*randn(len*Fs/Fd,2)... +j*.5*randn(len*Fs/Fd,2);
| Modulating the Signal | Demodulating the Signal | ![]() |