Signal Programming Lab Experiments with SCI Lab Software

Related image

Signal Processing Lab Experiments:

Front Page / Cover Page: Docx Format / PDF Format
Experiments: Docx Format / PDF Format


PROGRAM 1

 

AIM: Generation of continuous and discrete elementary signals (Periodic and non periodic) using mathematical expression.

 

Software requirement: - SCI LAB  

 

Theory: A wave is a disturbance that transfers energy from one place to another without requiring any net flow of mass. Waves can be broadly separated into pulses and periodic waves. A pulse is a single disturbance while a periodic wave is a continually oscillating motion. There is a close connection between simple harmonic motion and periodic waves; in most periodic waves, the particles in the medium experience simple harmonic motion.

Waves can also be separated into transverse and longitudinal waves. In a transverse wave, the motion of the particles of the medium is at right angles (i.e., transverse) to the direction the wave moves. In a longitudinal wave, such as a sound wave, the particles oscillate along the direction of motion of the wave.

Surface waves, such as water waves, are generally a combination of a transverse and a longitudinal wave. The particles on the surface of the water travel in circular paths as a wave moves across the surface.

Periodic waves

A periodic wave generally follows a sine wave pattern, as shown in the diagram.

 

 

 

 

 

 

 

 

 

 


 

Program code

 

 

 

//continous time cosine signal

t=-5:0.0001:5;

F=1;

y1=cos(2*F*t*pi);

subplot(3,2,1);

plot2d3(t,y1);

xlabel('Time');

ylabel('Magnitude');

title('continous time cosine signal');

 

//continous time sine signal

y2=sin(2*F*t*pi);

subplot(3,2,3);

plot2d3(t,y2);

xlabel('Time');

ylabel('Magnitude');

title('continous time sine signal');

 

//continous time aperiodic signal

y3=sin(2*F*t*pi).*t;

subplot(3,2,5);

plot2d3(t,y3);

xlabel('Time');

ylabel('Magnitude');

title('continous time aperiodic signal');

 

//discrete time cosine signal

n = -20:1:20;

f = 1/20;

y4=cos(2*f*n*pi);

subplot(3,2,2);

plot2d3(n,y4);

xlabel('Time');

ylabel('Magnitude');

title('discrete time cosine signal');

 

 

//discrete time sine signal

y5=sin(2*f*n*pi);

subplot(3,2,4);

plot2d3(n,y5);

xlabel('Time');

ylabel('Magnitude');

title('discrete time sine signal');

 

//discrete time aperiodic signal

y6=cos(2*f*n*pi).*n;

subplot(3,2,6);

plot2d3(n,y6);

xlabel('Time');

ylabel('Magnitude');

title('discrete time aperiodic signal');

 

 

 

 

 

 

 

                                                                 

 

 

 

 

 

 

 

 


 

Figure (Expected output):

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


 

VIVA VOICE QUESTION:

 

Q1. What is Signal?

 

Q2. What are periodic signal.

             

Q3.What is time period.

 

Q4.Unit step is periodic signal or not.

 

Q5. u(t)+u(-t) is periodic or not.

 

Q6. Exponential signal is periodic or not.

 

Q7. Sum of two periodic signal is always periodic signal. True or false?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PROGRAM 2

 

AIM: Generation of Continuous and Discrete Unit Step Signal.                                           

 

Software requirement: - SCI LAB  

 

Unit step: A signal with magnitude one for time greater than zero. We can assume it as a dc signal which got switched on at time equal to zero.

Unit step function is denoted by u (t). It is defined as u (t) =

·         It is used as best test signal.

·         Area under unit step function is unity.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Program code

 

t=-10:0.001:10;

x0=0;

x1=1;

y1=x1*(t>=0)+x0*(t<0);

subplot(4,3,1);

plot2d3(t,y1);

xlabel('Time');

ylabel('Magnitude');

title('Continuous Unit Step Function');

 

y2=x1*(t>=6)+x0*(t<6);

subplot(4,3,2);

plot2d3(t,y2);

xlabel('Time');

ylabel('Magnitude');

title('Continuous Unit Step u(t-6) Function');

 

y3=x1*(t>=-6)+x0*(t<-6);

subplot(4,3,3);

plot2d3(t,y3);

xlabel('Time');

ylabel('Magnitude');

title('Continuous Unit Step u(t+6) Function');

 

y4=x0*(t>=4)+x1*(t<4);

subplot(4,3,4);

plot2d3(t,y4);

xlabel('Time');

ylabel('Magnitude');

title('Continuous Unit Step u(-t+4) Function');

 

y5 = y3 - y2;

subplot(4,3,5);

plot2d3(t,y5);

xlabel('Time');

ylabel('Magnitude');

title('Continuous Unit Step u(t+6)-u(t-6) Function');

 

 

y6 = y3 + y2;

subplot(4,3,6);

plot2d3(t,y6);

xlabel('Time');

ylabel('Magnitude');

title('Continuous Unit Step u(t+6)+u(t-6) Function');

 

n=-10:1:10;

x0=0;

x1=1;

y7=x1*(n>=0)+x0*(n<0);

subplot(4,3,7);

plot2d3(n,y7);

xlabel('Time');

ylabel('Magnitude');

title('discrete Unit Step u(n) Function');

 

y8=x1*(n>=6)+x0*(n<6);

subplot(4,3,8);

plot2d3(n,y8);

xlabel('Time');

ylabel('Magnitude');

title('discrete Unit Step u(n-6) Function');

 

y9=x1*(n>=-6)+x0*(n<-6);

subplot(4,3,9);

plot2d3(n,y9);

xlabel('Time');

ylabel('Magnitude');

title('discrete Unit Step u(n+6) Function');

 

y10=x0*(n>=4)+x1*(n<4);

subplot(4,3,10);

plot2d3(n,y10);

xlabel('Time');

ylabel('Magnitude');

title('discrete Unit Step u(-n+4) Function');

 

y11 = y9 - y8;

subplot(4,3,11);

plot2d3(n,y11);

xlabel('Time');

ylabel('Magnitude');

title('discrete Unit Step u(n+6)-u(n-6) Function');

 

 

y12 = y9 + y8;

subplot(4,3,12);

plot2d3(n,y12);

xlabel('Time');

ylabel('Magnitude');

title('discrete Unit Step u(n+6)+u(n-6) Function');

 

 

 

Figure (Expected output):

 

 

 

 

 

 

 

 

 

 

 

 

VIVA VOICE QUESTION:

 

Q1. What is Signal?

 

Q2. What is unit step signal?

             

Q3.Differention of step signal is?

 

Q4. Integration of step signal is?

 

Q5. What is continues time signals?

 

Q6. What are discrete time signals?

 

Q7. What is Analog signal?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PROGRAM 3

 

AIM: Generation of Exponential and Ramp signals in Continuous & Discrete domain.

 

Software requirement: - SCI LAB  

 

Ramp signal: A signal whose magnitude increases same as time. It can be obtained by integrating unit step.Ramp signal is denoted by r (t), and it is defined as r (t) =

Area under unit ramp is unity.

 

Exponential signal: Exponential signal is in the form of x (t) = eαt. The shape of exponential can be defined by α.                                                                                                                            Case i: if α= 0 x(t) =e0= 1

Case ii: if α< 0 i.e. -ve then x (t) = e-αt.

The shape is called decaying exponential.

Case iii: if α> 0 i.e. +ve then x (t) = eαt .

The shape is called rising exponential.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Program code

 

 

t=-2:0.01:2;

a=2;

//continous time increasing exponential signal

y1=exp(a*t);

subplot(3,2,1);

plot2d3(t,y1);

xlabel('time');

ylabel('amplitude');

title('continous time increasing exponential signal');

 

//continous time decreasing exponential signal

y2=exp(-a*t);

subplot(3,2,2);

plot2d3(t,y2);

xlabel('time');

ylabel('amplitude');

title('continous time decreasing exponential signal');

 

 

 

//discrete time increasing exponential signal

n=-5:1:5;

a = 1/4;

y3=exp(a*n);

subplot(3,2,3);

plot2d3(n,y3);

xlabel('time');

ylabel('amplitude');

title('discrete time increasing exponential signal');

 

//discrete time decreasing exponential signal

y4=exp(-a*n);

subplot(3,2,4);

plot2d3(n,y4);

xlabel('time');

ylabel('amplitude');

title('discrete time decreasing exponential signal');

 

 

//continous ramp signal

x0=0;

y5=t.*(t>=0)+x0.*(t<0);

subplot(3,2,5);

plot2d3(t,y5);

xlabel('time');

ylabel('amplitude');

title('continous ramp signal');

 

//discrete ramp signal

y6=n.*(n>=0)+x0*(n<0);

subplot(3,2,6);

plot2d3(n,y6);

xlabel('time');

ylabel('amplitude');

title('discrete ramp signal');

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure (Expected output):

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

VIVA VOICE QUESTION:

Q1. What is Signal?

 

Q2. What is ramp signal?

 

Q3.What is Exponential signal.

             

Q4.Differention of ramp signal is?

 

Q5. Integration of ramp signal is?

 

Q6. What is continues time signals?

 

Q7. What are discrete time signals?

 

Q8. What is Analog signal?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PROGRAM 4

 

AIM: Continuous and Discrete Time Convolution (Using Basic Definition).

 

Software requirement: - SCI LAB  

 

Theory: A convolution is an integral that expresses the amount of overlap of one function as it is shifted over another function.It therefore "blends" one function with another. For example, in synthesis imaging, the measured dirty map is a convolution of the "true" CLEAN map with the dirty beam (the FOURIER TRANSFORM of the sampling distribution). The convolution is sometimes also known by its German name, faltung ("folding"). 

Abstractly, a convolution is defined as a product of functions  and  that are objects in the algebra of SCHWARTZ FUNCTIONS in. Convolution of two functions  and  over a finite range is given by

 

Where the symbol denotes convolution of  and .

Convolution is more often taken over an infinite range,

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Program code

 

(4A)

x=input('enter first sequence');

b1=input('enter the lower limit');

u1=input('enter the upper limit');

x1=b1:1:u1;

h=input('enter second sequence');

b2=input('enter the lower limit');

u2=input('enter the upper limit');

h1=b2:1:u2;

b=b1+b2;

u=u1+u2;

a=b:1:u;

m=length(x);

n=length(h);

X=[x,zeros(1,n)];

subplot(2,2,1);

disp('x(n) is:');

disp(x);

plot2d3(x1,x);

xlabel('n');

ylabel('x(n)');

title('first squence');

grid on;

H=[h,zeros(1,m)];

subplot(2,2,2);

disp('h(n) is;');

disp(h);

plot2d3(h1,h);

xlabel('n');

ylabel('h(n)');

title('second sequence');

grid on;

for  i=1:n+m-1

    Y(i)=0;

    for j=1:m;

        if((i-j+1)>0)

            Y(i)=Y(i)+(X(j)*H(i-j+1));

        else

        end

    end

end

subplot(2,2,[3  4]);

disp('y(n) is:');

disp(Y);

plot2d3(a,Y);

xlabel('n');

ylabel('Y(n)');

title('output sequence');

grid on;

(4B)

 

 

t1=-5:1:0

t2=0:1:2;

t3=2:1:5;

 

h1=zeros(size(t1));

h2=ones(size(t2));

h3=zeros(size(t3));

 

t=[t1 t2 t3];

h=[h1 h2 h3];

subplot(3,1,1);

plot2d3(t,h);

xlabel('time');

ylabel('magnitude');

 

a1=-5:1:0;

a2=0:1:4;

a3=4:1:6;

 

x1=zeros(size(a1));

x2=ones(size(a2));

x3=zeros(size(a3));

 

a=[a1 a2 a3];

x=[x1 x2 x3];

subplot(3,1,2);

plot2d3(a,x);

xlabel('time');

ylabel('magnitude');

 

 

c=conv(x2,h2);

subplot(3,1,3);

plot2d3(c);

xlabel('time');

ylabel('magnitude');

 

(4C)

x = input('enter the first seq');

N1 = length(x);

n1 = 0:1:N1-1;

subplot(2,2,1);

plot2d3(n1,x);

xlabel('time');

ylabel('mag');

title('seq of x');

 

h = input('enter the second seq');

N2 = length(h);

n2 = 0:1:N2-1;

subplot(2,2,2);

plot2d3(n2,h);

xlabel('time');

ylabel('mag');

title('seq of h');

 

y=conv(x,h);

n = 0:1:N1+N2-2;

subplot(2,2,[3 4]);

plot2d3(n,y);

xlabel('time');

ylabel('mag');

title('convolution');

 

 

 

 

 

 

 

Figure (Expected output):

 

Figure 4(c):

 

 

 

 

Input:

enter the first seq:=[0 1 2 3]

enter the second seq:=[2 3 4]

 

Output

y(n)= [0     2     7    16    17    12]

 

 

 

 

 

 

 

 

 

 

 

Figure 4(b):

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure 4(a):

 

 

 

Input & Output

enter first sequence:=[-2 -4 5 6]

enter the lower limit:=-1

enter the upper limit:=2

enter second sequence:=[3 4 5]

enter the lower limit:=0

enter the upper limit:=2

x(n) is:

    -2    -4     5     6

 

h(n) is;

     3     4     5

 

y(n) is:

    -6   -20   -11    18    49    30    38    24

 

Result:-I have performed convolution on matlab successfully.

 

VIVA VOICE QUESTION:

Q1. What is the importance of linear and circular convolution in signals and systems?

 

Q2. Write the properties of linear convolution.

 

Q3.What is formula for continuous time convolution signal?

 

Q4. What is formula for discrete time convolution signal?

 

Q5. What is meaning of time shifting.

 

Q6. What is impulse response? Explain its significance.

Q7. Which command we use in sci lab for performing convolution.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PROGRAM 5

 

AIM: Adding and subtracting two given signals (continuous as well as discrete signals).

Software requirement: - SCI LAB

 

Program Code

clc;

//continuous signal

t = 0:0.001:30;

y1 = t;

y2 = 2*t;

//First Signal

subplot(4,2,1);

plot2d3(t,y1);

xlabel('time');

ylabel('magnitude');

title('First Signal');

//Second Signal

subplot(4,2,2);

plot2d3(t,y2);

xlabel('time');

ylabel('magnitude');

title('Second Signal');

y3 = y1+y2;

y4 = y1-y2;

//Addition

subplot(4,2,3);

plot2d3(t,y3);

xlabel('time');

ylabel('magnitude');

title('Addition');

//subtraction

subplot(4,2,4);

plot2d3(t,y4);

xlabel('time');

ylabel('magnitude');

title('Subtraction');

 

//discrete signal

n=0:1:30;

a=n;

b=2*n;

//First Signal

subplot(4,2,5);

plot2d3(n,a);

xlabel('time');

ylabel('magnitude');

title('First Signal');

//Second Signal

subplot(4,2,6);

plot2d3(n,b);

xlabel('time');

ylabel('magnitude');

title('Second Signal');

c=a+b;     

d=a-b;

//Addition

subplot(4,2,7);

plot2d3(n,c);

xlabel('time');

ylabel('magnitude');

title('Addition');

//subtraction

subplot(4,2,8);

plot2d3(n,d);

xlabel('time');

ylabel('magnitude');

title('Subtraction');

 

 

Figure (Expected output):

 

 

 

 

 

 

 

 

 

 

VIVA VOICE QUESTION:

Q1. Addition of two periodic signals is periodic or not?

 

Q2. Addition of u (t) and u (-t) is …………….signals.

 

Q3. Subtraction of u (t) and u (-t) is …………….signals.

 

Q4. Addition of two even signals is even or odd?

 

Q5. Addition of two odd signals is even or odd?

 

Q6. Addition of even and odd signals is ?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PROGRAM 6

 

AIM: To generate uniform random numbers between (0,1).

Software requirement: - SCI LAB

Theory:

Two Classes Signals

Signals are subdivided into two classes, namely,

(1)Deterministic signals

(2)Random signals

Deterministic Signals & Random Signals

Signals that can be modelled exactly by a mathematical formula are known as deterministic signals. Deterministic signals are not always adequate to model real-world situations. Random signals, on the other hand, cannot be described by a mathematical equation; they are modeled in probabilistic terms.

It’s fairly easy to generate uncorrelated pseudo- random sequences. MATLAB has two built-in functions to generate pseudo-random numbers, namely rand and randn. The rand function generates pseudo-random numbers whose elements are uniformly distributed in the interval (0,1). You can view this as tossing a dart at a line segment from 0 to 1, with the dart being equally likely to hit any point in the interval [0,1]. The randn function generates pseudo-random numbers whose elements are normally distributed with mean 0 and variance 1 (standard normal). Both functions have the same syntax. For example, rand(n) returns a n-by- n matrix of random numbers, rand(n,m) returns a n-by-m matrix with randomly generated entries distributed uniformly between 0 and 1., and rand(1) returns a single random number.

- Random Number Generation: Pseudo-random Numbers -

>> %Generate one thousand uniform pseudo-random numbers

>>rand(1,1000)

% return a row vector of 1000 entries

>>%Generate one thousand gaussian pseudo-random numbers

>>randn(1,1000);

% return a row vector of 1000 entries

 

Program Code

clc;

n=input('Enter the number which is generated:');

y=rand(1,n);

//continuous signal

subplot(2,1,1);

plot2d3(n,y);   

xlabel('n');

ylabel('magnitude');

title('continuous signal');

//discrete signal

subplot(2,1,2);

plot2d3(n,y);

xlabel('n');

ylabel('magnitude');

title('discrete signal;');

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure (Expected output):

 

 

 

 

 

 

 

 

 

 

 

 

 

VIVA VOICE QUESTION:

Q1. What is Random Signal?

 

Q2. What is probability?

Q3.What is Maximum value of probability

             

Q4. How many types of discrete distribution.

 

Q5. What is uniform distribution?

 

Q6. Which command we use to generate random signal?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PROGRAM 7

 

AIM: To generate a random binary wave.

Software requirement: - SCI LAB

 

Program Code

n = input('enter the total number which is generated N=');

j = 0;

y1 = rand(1,n);

y = round(y1);

for i= 1:n

    if  y(i) == 1;

        j(i) = ones;

    else

        j(i) = zeros;

    end

end

plot2d3(j);

xlabel('no. of random signal');

ylabel('amplitude');

title('plot of random in ones and zeros 0-1');

 

 

 

 

 

 

 

 

 

 

 

 

Figure (Expected output):

 

 

 

 

 

 

 

 

 

 

 

 

 

 

VIVA VOICE QUESTION:

Q1. What is Random Signal?

 

Q2. What are binary signals?

Q3. Binary wave generated by which command?

           

Q4. What is uniform distribution?

 

Q5. Which command we use to generate random signal?

 

Q6. What is used of round command?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PROGRAM 8

 

AIM: To generate and verify random sequences with arbitrary distributions, means and Variances for following:                                                                                                                 (a) Rayleigh distribution                                                                                                                   (b) Normal distributions: N(0,1)                                                                                                      (c) Poisson distributions: N(m, x)

 

Software requirement: - SCI LAB

Theory:

(a)The Rayleigh distribution- it is a special case of the WEIBULL DISTRIBUTION. If A and B are the parameters of the Weibull distribution, then the Rayleigh distribution with parameter b is equivalent to the Weibull distribution with parametersA=21/2 b and B = 2.

If the component velocities of a particle in the x and y directions are two independent normal random variables with zero means and equal variances, then the distance the particle travels per unit time is distributed Rayleigh.

In communications theory NAKAGAMI DISTRIBUTION, RICIAN DISTRIBUTION, and Rayleigh distributions are used to model scattered signals that reach a receiver by multiple paths. Depending on the density of the scatter, the signal will display different fading characteristics. Rayleigh and Nakagami distributions are used to model dense scatters, while Rician distributions model fading with a stronger line-of-sight. Nakagami distributions can be reduced to Rayleigh distributions, but give more control over the extent of the fading.

The Rayleigh pdf is

y=   f(x) =   

(b) The Normal distributions-

A normal distribution in a VARIATE  with MEAN  and VARIANCE  is a statistic distribution with probability density function

(1)

on the domain . While statisticians and mathematicians uniformly use the term "normal distribution" for this distribution, physicists sometimes call it a Gaussian distribution and, because of its curved flaring shape, social scientists refer to it as the "bell curve."

The so-called "standard normal distribution" is given by taking and in a general normal distribution. An arbitrary normal distribution can be converted to a standard normal distribution by changing variables to , so , yielding

 

(c) The Poisson distributions-

A Poisson random variable is the number of successes that result from a Poisson experiment. The probability distribution of a Poisson random variable is called a Poisson distribution.

Given the mean number of successes (μ) that occur in a specified region, we can compute the Poisson probability based on the following formula:

Poisson Formula. Suppose we conduct a Poisson experiment, in which the average number of successes within a given region is μ. Then, the Poisson probability is:

P(x; μ) = (e-μ) (μx) / x!

Where x is the actual number of successes that result from the experiment and e is approximately equal to 2.71828.

The Poisson distribution has the following properties:

·         The mean of the distribution is equal to μ .

·         The variance is also equal to σ.

 

 

 

 

 

 

 

 

 

 

Program code

//normal distribution

x = -5:0.01:5;

y1 = (normpdf(x,0,1));

y2 = (normpdf(x,0.1,2));

y3 = (normpdf(x,0,0.5));

subplot(3,1,1);

plot2d3(x,y1,'.',x,y2,'-',x,y3,'*');

xlabel('value of x');

ylabel('value of y');

title('normal distribution');

 

 

//rayleigh distribution

x = -5:1:15;

y1 = (poisspdf(x,4));

y2 = (poisspdf(x,2));

y3 = (poisspdf(x,1));

subplot(3,1,2);

plot2d3(x,y1,'.',x,y2,'-',x,y3,'*');

xlabel('value of x');

ylabel('value of y');

title('rayleigh distribution');

 

//poission distribution

x = -5:1:15;

y1 = (raylpdf(x,4));

y2 = (raylpdf(x,2));

y3 = (raylpdf(x,1));

subplot(3,1,3);

plot2d3(x,y1,'.',x,y2,'-',x,y3,'*');

xlabel('value of x');

ylabel('value of y');

title('poission distribution');

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure (Expected output):

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

VIVA VOICE QUESTION:

Q1. What is pdf?

 

Q2. What is cdf.

 

Q3.What are the Mean and variance of Poisson distribution?

 

Q4. What are the Mean and variance of Normal distribution?

 

Q5.Which command we use in scilab to plot pdf of normal distribution.

 

Q6.Normal distribution is continuous or discrete?

 

Q7.If value of probability is very small and number is large than which distribution is used?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PROGRAM 9

 

AIM: To plot the probability density functions. Find mean and variance for the above Distributions                                                                                                                       

Software requirement: - SCI LAB

Theory: PDF: in probability theory, a probability density function (PDF), or density of a continous random variable, is a function, whose value at any given sample (or point) in the sample space (the set of possible values taken by the random variable) can be interpreted as providing a relative likelihood that the value of the random variable would equal that sample.In other words, while the absolute likelihood for a continuous random variable to take on any particular value is 0 (since there are an infinite set of possible values to begin with), the value of the PDF at two different samples can be used to infer, in any particular draw of the random variable, how much more likely it is that the random variable would equal one sample compared to the other sample.

In a more precise sense, the PDF is used to specify the probability of the random variable falling within a particular range of values, as opposed to taking on any one value. This probability is given by the integral of this variable’s PDF over that range—that is, it is given by the area under the density function but above the horizontal axis and between the lowest and greatest values of the range. The probability density function is nonnegative everywhere, and its integral over the entire space is equal to one.

The terms "probability distribution functions" and "probability function" have also sometimes been used to denote the probability density function. However, this use is not standard among probability and statisticians. In other sources, "probability distribution function" may be used when the probability distribution is defined as a function over general sets of values, or it may refer to the cumulative distribution function, or it may be a probability mass function (PMF) rather than the density. "Density function" itself is also used for the probability mass function, leading to further confusion. In general though, the PMF is used in the context of discrete random variables (random variables that take values on a discrete set), while PDF is used in the context of continuous random variables.

 

CDF: (Cumulative Distribution Function)As the name cumulative suggests, this is simply the probability up to a particular value of the random variable, say x. Generally denoted by F, F= P (X<=x) for any value of x in the X space. It is defined for both discrete and continuous random variables.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Program code

//pdf

mu = 100;

sigma = 15;

xmin = 70;

xmax = 130;

n = 100;

k = 10000;

x = linspace(xmin,xmax,n);

p = normpdf(x,mu,sigma);

subplot(2,1,1);

plot2d3(x,p);

xlabel('x');

ylabel('pdf');

title('probability density function');

 

//cdf

mu = 100;

sigma = 15;

xmin = 70;

xmax = 130;

n = 100;

k = 10000;

x = linspace(xmin,xmax,n);

c = normcdf(x,mu,sigma);

subplot(2,1,2);

plot2d3(x,c);

xlabel('x');

ylabel('pdf');

title('cumulative distribution function');

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure (Expected output):

 

 

 

 

 

 

 

 

 

 

 

 

 

 

VIVA VOICE QUESTION:

Q1. What is pdf?

 

Q2. What is cdf.

 

Q3.What is the Mean and variance of Poisson distribution?

 

Q4. What are the Mean and variance of Normal distribution?

 

Q5.Which command we use in matlab to plot pdf of normal distribution.

 

 

 

 

 

Comments

Popular posts from this blog

Front Page