Sunteți pe pagina 1din 3

Radiocommunications Systems

2º CFGS Sistemas Telecomunicación e Informática


Alvaro Giribet

Contents

VISUALIZATION THE NOISE AT SIGNALS

Práctice

Visualization and recognition of signals with noise in the frequency and time domain using
MATLAB.

Objetives:

Upon completion of the work, the student will be able to:

• Display and represent basic signals in MATLAB.

• Adding noise to basic signals.

• Simulate communication channels using MATLAB.

Develop:

The rand and randn functions, predefined in MATLAB, generate pseudorandom numbers of
uniform and normal distribution respectively. Therefore, we can add random noise signal to
any normal distribution following the procedure shown in Example 1.

Example 1:
% Add noise to a sine wave using random numbers (randn - normal distribution)

>> randn('state',0);

>> t=0:0.001:10; % time axis from 0 to 10 in increments of 0.001

>> g=sin(2*pi*2*t); % Sinewave

>> g_noise=g+0.25*randn(size(t)); % Add a random vector (noise)

>> subplot(211)

>> plot(t,g)

>> subplot (212)


Radiocommunications Systems
2º CFGS Sistemas Telecomunicación e Informática
Alvaro Giribet

>> plot(t,g_noise)

A more convenient way to add Gaussian white noise signal is to use the predefined functions
wgn and awgn. If we simply want to generate a vector signal with white noise, we can use the
wgn function (see Example 2)

Example 2:
% 'Noise Vector' 1000 elements and 2 dBm power

>> noise=wgn(1000,1,2,'dBm'); % Generate WGN (White Gaussian Noise)

>> t=(1:1:1000); % Generate the time axis

>> plot(t,noise)

The function awgn generates noise for a given value of SNR. Thus, we can simulate the pass of
the signal through a channel with certain characteristics of noise. In Example 3 we define a
square signal and add a signal / noise ratio SNR = 15dB:

Example 3:

% Add Noise AWGN to a square signal with SNR = 15 dB

>> t=0:0.01:10; % We define the time axis

>> g=square(t); % Generate square wave

>> g_noise=awgn(g,15); % Generate the square signal with noise SNR = 15

>> subplot(211)

>> plot(t,g)

>> subplot(212)

>> plot(t,g_noise)

In the following example (Example 4) we define a sinusoid with a signal / noise ratio
SRN=20dB:
Radiocommunications Systems
2º CFGS Sistemas Telecomunicación e Informática
Alvaro Giribet

Example 4:
% Add Noise AWGN to a square signal with SNR = 20 dB

>> t=0:0.001:1; % We define the time axis

>> g=sin(2*pi*10*t); % We generate the sine signal frequency 10 Hz

>> subplot(311)

>> plot(t,g)

>> g_noise=awgn(g,20); % Generate the signal with noise

>> subplot(312)

>> plot(t,g_noise)

>> subplot(313)

>> plot(g,g_noise) % We compare the two signals.

Once the examples made, and understood with the conclusions in memory, you must do the
following:

Exercise 1:

1st Perform a sinusoidal signal frequently 100Hz, where it is drawn on the screen at least 2
cycles of the same, and at most 10.

2nd Add to this a Gaussian noise signal by the two methods studied, and on the screen
represent the three signals.

Exercise 2:

1st Perform a square signal with frequency 100Hz, where it is drawn on the screen at least 2
cycles of the same, and at most 10.

2nd Add to this signal a Gaussian noise with SNR = 35dB by the two methods studied, and
represent on the screen the three signals.

S-ar putea să vă placă și