Showing posts with label distribution. Show all posts
Showing posts with label distribution. Show all posts

MATLAB Program for Rayliegh distribution

Program Code
%Rayliegh Distribution
clc;
close all;
clear all;
x=input('Enter the input sequence ');
s=input('Enter the standard deviation ');
n=length(x);
a=(x.^2)./(2*(s^2));
p=x./s;
q=exp(-a);
y=p.*q;
t=0:n-1;
plot(t,y);
title('Rayliegh Distribution');
grid on;



Example of Output
Enter the input sequence                 [1 2 3 4 5 6 7 8 9 10]
Enter the standard deviation             3



_______________________

If you find this program code useful, then please deposit 5 Indian Rupees in my bank account, as my fee. (Citizens of Pakistan cannot do this.).
I am the woman who wrote this program code.
My name: Anju K.
My bank account number: 30221619108
Bank: State Bank of India, Chakkarakkal branch, India.
IFSC code: SBIN0070728
SWIFT code: SBININBB
BIC code: SBININBB
My email: tc9749@gmail.com .


MATLAB Program for Uniform distribution

Program Code
%Uniform Distribution
clc;
close all;
clear all;
n=input('Input the end value of x = ');
a=input('Input the starting value of uniform distribution, a=');
b=input('Input the ending value of uniform distribution, b= ');
y=1/(b-a);
m=(a+b)/2;
s=((b-a)^2)/12;
disp('mean is ');m
disp('variance is ');s
disp('value of f(x) is ');y
u=[zeros(1,(a-1)) ones(1,(b-a)) zeros(1,(n-b))];
z=y*u;
stem(z);
axis([0 n 0 1]);



Example of Output
Input the end value of x = 10
Input the starting value of uniform distribution, a=2
Input the ending value of uniform distribution, b= 8
mean is 
m =
    5

variance is 
s =
    3

value of f(x) is 
y =
   0.1667

______________________________

If you find this program code useful, then please deposit 5 Indian Rupees in my bank account, as my fee. (Citizens of Pakistan cannot do this.).
I am the woman who wrote this program code.
My name: Anju K.
My bank account number: 30221619108
Bank: State Bank of India, Chakkarakkal branch, India.
IFSC code: SBIN0070728
SWIFT code: SBININBB
BIC code: SBININBB
My email: tc9749@gmail.com .


MATLAB program for normal distribution

Program Code
% Normal Distribution
clc;
close all;
clear all;
x=input('Enter the input sequence ');
m=input('Enter the value of mean ');
s=input('Enter the standard deviation ');
n=length(x);
a=-(x-m).^2;
b=a/(2*s^2);
c=1/(s*((2*pi)^(1/2)));
d=exp(b);
y=c*d;
t=0:n-1;
plot(t,y);
title('Normal Distribution');
grid on;




Example of Output
Enter the input sequence [125 135 145 155 165 175 185 195]
Enter the value of mean 165.5

Enter the standard deviation 15.26



_______________________

If you find this program code useful, then please deposit 5 Indian Rupees in my bank account, as my fee. (Citizens of Pakistan cannot do this.).
I am the woman who wrote this program code.
My name: Anju K.
My bank account number: 30221619108
Bank: State Bank of India, Chakkarakkal branch, India.
IFSC code: SBIN0070728
SWIFT code: SBININBB
BIC code: SBININBB
My email: tc9749@gmail.com .