Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

How can i create histogram of these variables that would show the depth of sensors when temperature is 0 Degree Celsius. Time function is 0 min, 50 min, 100 min, 150 min, 200 min, and 250 min and depth of sensors in ground is 10cm, 20cm, 30cm, 40cm, and 50cm.

The first number indicates the running time in minutes, followed by a 5 sensors temperature readings, first is in 10cm depth and last in 50cm

Mydata= {{0, -0.65625`, 0.4375`, 0.625`, 0.75`, 1.6875`},
{50, -0.71875`, 0.4375`, 0.5`, 0.8125`, 1.5`},
{150, -0.78125`, 0.34375`, 0.5625`, 0.8125`, 1.5625`},
{200, -0.8125`, 0.46875`, 0.53125`, 0.65625`, 1.5`},
{250, -0.8125`, 0.375`, 0.53125`, 0.6875`, 1.5`}};
share|improve this question
    
For the sake of clarity, I want to point out that Mathematica has a Histogram function and a million other pieces of statistics-related functionality. And a general tip in case you don't already know: Click on a piece of text in a Mathematica notebook and press F1 to search the help documentation for that item. –  amr Dec 12 '12 at 21:29

2 Answers 2

Perhaps what is wanted is a plot of collected temperatures as a function of time and depth. This can be done as follows.

First the data must be transformed into a set of points of the form {time, depth temperature}.

data = {{0, -0.65625`, 0.4375`, 0.625`, 0.75`, 1.6875`}, 
        {50, -0.71875`, 0.4375`, 0.5`, 0.8125`, 1.5`},
        {150, -0.78125`, 0.34375`, 0.5625`, 0.8125`, 1.5625`},
        {200, -0.8125`, 0.46875`, 0.53125`, 0.65625`, 1.5`},
        {250, -0.8125`, 0.375`, 0.53125`, 0.6875`, 1.5`}};
depth = Range[10, 50, 10];
time = First /@ data;
values1 = Rest /@ data // Flatten;
xy = Flatten[Table[{i, j}, {i, time}, {j, depth}], 1];
values2 = MapThread[Append, {xy, values1}]

{{0, 10, -0.65625}, {0, 20, 0.4375}, {0, 30, 0.625}, {0, 40, 0.75}, {0, 50, 1.6875},
{50, 10, -0.71875}, {50, 20, 0.4375}, {50, 30, 0.5}, {50, 40, 0.8125}, {50, 50, 1.5},
{150, 10, -0.78125}, {150, 20, 0.34375}, {150, 30, 0.5625}, {150, 40, 0.8125}, {150, 50, 1.5625},
{200, 10, -0.8125}, {200, 20, 0.46875}, {200, 30, 0.53125}, {200, 40, 0.65625}, {200, 50, 1.5},
{250, 10, -0.8125}, {250, 20, 0.375}, {250, 30, 0.53125}, {250, 40, 0.6875}, {250, 50, 1.5}}

Now values2 can be plotted.

ListPlot3D[values2]

enter image description here

share|improve this answer

I don't know what you mean by "histogram" but assuming you just mean a bar chart.

I'll use linear interpolation (InterpolationOrder -> 1).

depths = 10 Range[5]

readings = Thread @ {Rest @ #, depths} & /@ Mydata

zeros = Interpolation[#, InterpolationOrder -> 1][0] & /@ readings

BarChart[zeros, ChartLabels -> labels]

Mathematica graphics

If this is not what you want you'll have to be more specific.

share|improve this answer
    
Yes thanks, that works like i wanted, but when i try with 25 sensors and 43 timepoints i'll get "My data is not a valid dataset or list of datasets" I have been putting: depths = 10 Range[25] readings = Thread@{Rest@#, depths} & /@ Mydata zeros = Interpolation[#, InterpolationOrder -> 1][0] & /@ readings BarChart[zeros, ChartLabels -> labels] But do you know, how should i change that so i would get bar chart from these 25 sensors? –  Raymond... Dec 13 '12 at 16:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.