www.gusucode.com > UWB_matlab源码程序 > CP0801/cp0801_Gnoise2.m
% % FUNCTION 8.3 : "cp0801_Gnoise2" % % Introduces additive white Gaussian noise over signal % 'input'. % Vector 'exno' contains the target values of Ex/No (in dB) % 'numpulses' is the number of pulses composing the input % signal % % Multiple output signals are generated, one signal for % each target value of Ex/No. The array 'output' contains % all the signals (input+AWGN), one signal per row. % The array 'noise' contains the different realization of % the Gaussian noise, one realization per each row. % % Programmed by Guerino Giancola % function [output,noise] = ... cp0801_Gnoise2(input,exno,numpulses) % ------------------------------- % Step One - Introduction of AWGN % ------------------------------- Ex = (1/numpulses)*sum(input.^2); % measured energy per % pulse ExNo = 10.^(exno./10); % Ex/No in linear units No = Ex ./ ExNo; % Unilateral spectral % density nstdv = sqrt(No./2); % Standard deviation for % the noise for j = 1 : length(ExNo) noise(j,:) = nstdv(j) .* randn(1,length(input)); output(j,:) = noise(j,:) + input; end