MATLAB PROGRAM TO FIND THE PROBABLITY OF NUMBER 1 TO 6 COMES IN DICE

Here is a MAT LAB program to calculate a probability of a dice for how many times 1 to 6 numbers come.write down this program in m-file of MAT LAB.
------------------------------------------------------------------------------------------------------------
 %MAT LAB PROGRAM TO FIND THE PROBABILITY OF NUMBER 1 TO 6 COMES IN DICE

clc;
clear all;
close all;
n=input(' how many times you want to do experiment :  ')
x={1,2,3,4,5,6};
min=1;
max=length(x);
b=round(min+(rand(1,n)*(max-min));
for i=1:max
     p(i)=(length(find(b==i)));
end
bar(x,p)
------------------------------------------------------------------------------------------------------------
AFTER WRITING THIS CODE SAVE  AND RUN IT.YOU WILL SEE THE BAR CHART AS OUTPUT SHOWS  BELOW :


Comments

Popular posts from this blog

MATLAB program to find Frequency Modulation