Share
Explore BrainMass

Matlab script for statistics and histogram

(See attached file for full problem description)

Any help is greatly appreciated, as the script I wrote does not seem to be deciphering between the two sets of data.

---
Write a Matlab script using the "randn" command to generate a vector of 10,000 random numbers that are normally distributed around zero, with a variance of 1. Use the "hist" command to plot a histogram of these data, specifying 50 bins. Use "find" command to determine what percentage of the data points lie within 1 standard deviation of the mean (which is zero). Redo this analysis for a smaller set of data (20 points) and reduce number of bins in the histogram.
---

Attachments

Solution Preview

I attach file task33.m:

it is a MatLab program which does what is requested in 3.3.doc you posted.

It calculates the random numbers, plots histograms, and finds the fractions within one sigma for 10000 numbers - 50 bins - drawn in Figure 101
and for
20 numbers - 5 bins - drawn in figure 102

I hope is helps and the comments in the file are sufficient.

The function
ret = within1sigma(x)
just creates another vector (instead ...

$2.19