Sunteți pe pagina 1din 4

11-01-19 5

EXPERIMENT- 3

Aim:
Write a MATLAB program to generate the signal S(n)= 2n (0.8)^n corrupted by the noise d(n),
resulting X(n)= S(n)+d(n) .Also down sample the sequence.

Tools Used:
MATLAB R2012a.

Theory:
In signal processing, noise is a general term for unwanted (and, in general, unknown) modifications that
a signal may suffer during capture, storage, transmission, processing, or conversion.[1]Sometimes the
word is also used to mean signals that are random (unpredictable) and carry no useful information; even
if they are not interfering with other signals or may have been introduced intentionally, as in comfort
noise. The heart of digital noise generation is random number generator.
When downsampling (decimation) is performed on a sequence of samples of a signal or other
continuous function, it produces an approximation of the sequence that would have been obtained by
sampling the signal at a lower rate (or density, as in the case of a photograph).Downsampling a signal by
M can produce M unique phases.
Matlab Code:
clc;
close all;
clear all;

n=1:1:10;

%generation of signal
for i=1:10
s(i)= 2*i *((0.8).^i);
end

%generation of noise
d=rand(1,length(n));

%generation of corrupted noise


x=s+d;

% downsampling signal
y=downsample(x,2);

%plotting signals
subplot(2,2,1), stem(m,s);
subplot(2,2,2), stem(m,d);
subplot(2,2,3), stem(m,x);
subplot(2,2,4),stem(y);
6

Plots:

Conclusion:
Noise signal is generated using rand function that gives random numbers between 0 and 1.Resulting
signal is obtained by adding noise signal to the original signal resulting in x(n).Downsampled signal is
obtained by using downsample function that downsamples x by an integer (here: ‘2’). All the plots are
obtained by using sub plots and stem( for discrete signals).

Result:
Different graphs corresponding to different sequences have been plotted and verified.
11-01-19 7.

EXPERIMENT- 3

Aim:
Generate Gaussian number with mean=20 and variance=40. Plot probability Density function of the
generated numbers

Tools Used:
MATLAB R2012a.

Theory:
The general theory of random variables states that if x is a random variable whose mean is μx and
variance is σ2x, then the random variable, y, defined by y=ax+b,where a and b are constants, has
mean μy=aμx+b and variance σ2y=a2σ2x.
A distribution of values that cluster around an average (referred to as the “mean”) is known as a
“normal” distribution. It is also called the Gaussian distribution .The curve is generated by a
mathematical function that defines the probability of any given value occurring as a function of the
mean (often written as μ, the Greek letter mu) and standard deviation (σ, the Greek letter sigma).

Normal distributions are symmetric around their mean.The mean, median, and mode of a normal
distribution are equal.The area under the normal curve is equal to 1.0.Normal distributions are denser in
the center and less dense in the tails.

Matlab Code:
clc;
clear all;
close all;

n=1:0.5:40;
%Generate guassian number
x= normrnd(20,(40.^(0.5)) , 1, length(n));

%Generate guassian distribution


f=(1/((2*pi*40).^0.5))*exp(-(((n-20).^2)/80))

%for verification
g=normpdf(n,20,(40.^(0.5)));

%plotting graphs
subplot(3,1,1), stem(n,x); subplot(3,1,2), stem(n,f);
subplot(3,1,3), stem(n,g);
8

Plots:

Conclusion:
Guassian number is generated by using function normrnd(mu,sigma) generates a random number from
the normal distribution with mean parameter mu and standard deviation parameter sigma. Guassian pdf
is obtained from formula itself giving values for mean and variance. The plot obtained is verified using
normpdf function that gives the normal probability density function. If X is a vector then the
command normpdf(X,mu,sigma) computes the normal density with parameters mu and sigma at each
value of X. The command normpdf(X) computes the standard normal density at each value of X.

Result:
Different graphs corresponding to different sequences have been plotted and verified.

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