Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please write a code in matlab, most important parts are 3 and 4, but i will be grateful if you do 1 and 2. Histograms
please write a code in matlab, most important parts are 3 and 4, but i will be grateful if you do 1 and 2.
Histograms are graphical representations of of data. Anormalized histogram, thus, should provide an estimate of the probability distribution of the outcomes of an experiment. Generating the histogram for discrete data can be as easy as running an experiment several times and counting the number of occurrences of each outcome Perform the following tasks l. Write your own histogram generating algorithm for integer data, i.e. write a function that calculates the histogram and returns the frequency counts when called as follows histX my Hist. 1 (X) Note that will be a vector with the outcomes of the desired events e.g. if you have random binary number generator, X will be a sequence of 1s and bs You can plot your histogram using the bar function Compare your plot to the output of Matlab s command histogram (X) They should be equal or at least very similar 2. Study matlab's histogram and histcounts functions. How can you plot probability estimates rather than frequency counts? 3. Plot the probability estimates using a bar graph) of tossing a fair die a) 100 and b) 1000000times Calculate the average percent error in each of the runs 4. Calculate the average percent errors for tossing a fair die for 50different numbers oftosses, n. At least, generate 50 points corresponding to n values logarithmically spaced values between 100 and 1000000 (function logspace may be of help Plot the error vs. number of tosses. Note that the error becomes exponentially lower as the number of repetitions is increasedStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started