Skip to main content
1-Visitor
January 9, 2014
Solved

histogram

  • January 9, 2014
  • 2 replies
  • 7563 views

I have these two sets of data one a vector being the length of particles(L),and the other a vector of the number of particles of a particular length(N). I can plot N versus L alright but the problem is the points in L are not equally spaced, therefore the N (Vs.)L plot is not exactly a histogram. My question is how to convert these two sets of data into a histogram?

making a single vector out of L and N ( a vector of length where each particular Li is repeated Ni times) is out of question since the elements in N are in the order of millions and the produced vector will be bigger than what mathcad can handle.

Best answer by Werner_E

So here is a third version of mk_histo(). A very little bit slower (noticable only with big vector v and a high number of intervals). This time the third parameter can either be a positive integer or a vector with interval limits. Same meaning as the first parameter in the built in functions hist() and histogram().

2 replies

25-Diamond I
January 9, 2014

The Mathcad functions hist() and histogram() wont work for you unless you create the big combined vector you described. So I guess you will have to write a small program to do what you want.

Maybe you set up and post a demo wirksheet with dummy data (does not need to be the millions values you described) and state what kind of histogram you expect.

24-Ruby IV
January 9, 2014

Werner Exinger wrote:

Maybe you set up and post a demo...

I can only this way to create a histogram in Prime

Do you know one better way?

(About this task - http://communities.ptc.com/videos/3543)

GL.png

25-Diamond I
January 9, 2014

I can only this way to create a histogram in Prime

Unfortunately MortezaA cannot use histogram(), like you suggested, because he is not able to create the necessary datavector, as he wrote. To explain it with your example (btw, your column headers are interchanged): you have one vector with all possible heights and a second one with the number of people being that tall. The values in the first vector are not equally spaced and so the two vectors do not apply for a true histogram.

In your example you have a dataset with only 48 samples and are creating a histogram with 1000 bins!?? Also I think that plot type "column trace" is more suitable for histogram plots that the "line trace" in your sheet.

I don't know what Mortezaa expects from the histogram and in which format he would need the histo-data as a result, but I guess he is in need for something like the following (I am assuming people are using real Mathcad unless otherwise stated):

09.01.png

Werner_E25-Diamond IAnswer
25-Diamond I
January 10, 2014

So here is a third version of mk_histo(). A very little bit slower (noticable only with big vector v and a high number of intervals). This time the third parameter can either be a positive integer or a vector with interval limits. Same meaning as the first parameter in the built in functions hist() and histogram().