Re: Histogram Functions



mees wrote:
>
>
> NZTideMan wrote:
>>
>>
>> I don't understand why your being new to Matlab should make
hist
>> difficult.
>> I haven't looked at the details of hist, but I assume it does
>> something
>> like this:
>> 1. Sort the data into ascending order
>> 2. Count the number of data that fall into each bin (either
> defined
>> by
>> the user or assumed to be equispaced from min to max.)
>>
>> You could code this up yourself.
>> All hist is is a shortcut for you, to save you the time coding
> it.
>> If you don't understand how to use it, you should make your own
>> hist to
>> do exactly what you want to achieve.
>> That's what you as a novice needs to learn, i.e., there's
nothing
>> magic
>> about commands like hist or mean or kurtosis. They're just a
>> shortcut.
>> You could code them yourself.
>>
>>
>
> Hi,
>
> A histogram is a graph that shows how frequently a particular
> 'event'
> occurs. Say you have a town with
> a population of 50,000 and you want to figure out
> the age distribution of the inhabitants. To use the
> hist function you would need two set of data:
>
> 1.
> A vector of length 50,000 containing the age of each
> person.
> age = [age_data_goes_here];
>
> 2.
> A vector of bins defining the age categories e.g. in age intervals
> of
> 15 yrs, beginning at 0yrs and ending at 100yrs:
> bin = [0:15:100];
>
> 3.
> With this data the following command in MATLAB:
> hist(bin, age)
>
> should plot a bar graph with the age categories on the
> x-axis and the number of people in that age category on
> the y-axis.
>
> If you did not specify the bin sizes and just typed the command:
> hist(age)
>
> MATLAB would plot the data with 10 bin intervals divided equally
> between the highest and lowest ages that occurred in the age[]
> vector
> above.
>
> In the MATLAB function online help pages, one of the examples
> defines
> the vector of input data (analogous to the age vector above) as a
> random vector y of 10,000 elements:
> y = randn(10000,1);
>
> The bins are defined by a vector x with intervals of 0.1 in the
> range
> -2.9 to 2.9:
> x = -2.9:0.1:2.9;
>
> Hope this helps!
> M

Sorry, I just noticed a typo in the mail above, the code in point 3,
should read:
hist(age, bin);
.



Relevant Pages

  • Re: Histogram Functions
    ... Count the number of data that fall into each bin (either defined ... A vector of length 50,000 containing the age of each ... With this data the following command in MATLAB: ...
    (comp.soft-sys.matlab)
  • Re: Problem Help :D
    ... Trying to teach myself MATLAB for personal reasons and i found this ... but if you dont wana help then dont! ... the grave, figuratively speaking, I am very likely well beyond your age. ...
    (comp.soft-sys.matlab)
  • Efficency of assigning data to class properties
    ... As far as I have read classes in matlab are immutable. ... If I have a class representing a person which have an age (basic ... then I have a houndred person constructions and 99 are unused ...
    (comp.soft-sys.matlab)
  • Re: Problem Help :D
    ... im probably twice your age! ... Regardless of where you found this ... Matlab and on the file exchange. ...
    (comp.soft-sys.matlab)
  • Re: Traversing web pages
    ... Mr. Arnold wrote: ... command like ... select drop down list labelled "age", ... There might be some kind of 3rd party tool using a C# ASPNet Codebehind file solution that could control the Web page. ...
    (microsoft.public.dotnet.languages.csharp)