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 .


No comments:

Post a Comment

Please write your opinion about this MATLAB program here, only in English.