(1)Using the Matlab code developed in Software Assignment#1:
a. Convert the code that generates the random number (H,T) withequal probabilities into a function called myBernolli(p, S) thattakes as an input the probability of success p and S is the outcomedefined as success (either T or H) and returns the outcome of thetrial (either T or H).
b. Test that your function is actually producing the successfuloutcome with probability p by running the function in a loop of1000 trials and counting how many times success is produced (itshould be close to p*1000).
c. Write a Matlab function called myBinomial(n,p) that takes asan input the total number of trials n, the probability of success pand the outcome defined as success S and uses myBernolli() toreturn as an output the number of successes x.
d. Write a Matlab function called myGeometric() that takes as aninput the probability of success p and the outcome defined assuccess S and uses myBernolli() to return as an output the numberof trials till first success x.
e. Verify that myBinomial() and myGeometric() generates valuesthat follow Binomial and Geometric Distributions by running each ofthem 5000 times in a loop and plotting a histogram of the randomvariable x generated from each.
Hints: Random numbers with probability p are generated in Matlabusing the command function rand(). Read the help on Matlab to knowhow to use the function by typing help rand in Matlab command line.Histogram plots [hist()] is a function in Matlab. Read its help toknow how to produce