Azzera filtri
Azzera filtri

Help with histogram physics

5 visualizzazioni (ultimi 30 giorni)
michael
michael il 27 Lug 2011
So current I am doing a very famous muon physics lab for relativity that was made by Teach Spin. http://www.teachspin.com/instruments/muon_physics/experiments.shtml http://www.matphys.com/muon_manual.pdf
In this experiment one measures the decay lifetime of the muon and compares it at two different latitudes to measure the change due to special relativity.
The original code that makes a histogram of the muon decay like in the plot above is not working correctly, so I have extracted the data tried to plot the histogram using hist().
What I need to do is actual extract the frequency and bin number values that hist.m makes from a data set of 20,000 muon decay values(*). To then do the proper analysis, I have to take the logarithm of the frequency and then analyze it.
My problem is that plot hist.m file does not allow easy regression analysis and I am not able to easily extract the actual frequency and bins numbers for bin size greater than 20. (Unless of course by hand, which is tedious). I have tried to use histc() however, histc() different method of binning creates a horizontal shift. This horizontal shift introduces the value of the muon lifetime by about 40% of the actual value of 2.0 microseconds.
So I was wondering if anyone knew either: a) what variable(s) in the .m code of hist() stores the bins numbers and frequency numbers just before they are plotted OR b) it there any way to modify histc() correctly so it behaves just like hist() except giving the frequency and bin values?
Sincerely,
Michael
P.S. Since this question has been asked before, when I am done I am going to post the full code for analysis so future physics users can use matlab as an easy fix to this bug. That why I am asking this in the newsgroup thread as well.
  2 Commenti
Andreas
Andreas il 5 Ago 2011
I have the same problem. Did you ever figure out how to extract the frequency from the histogram?
Best wishes,
Andreas
Image Analyst
Image Analyst il 6 Ago 2011
I'm not sure I understand the problem. histc() allows you to specify the starting and ending value for each bin, and the value in that bin is the frequency of occurrence for data values in that bin's range, so what's the problem again?

Accedi per commentare.

Risposte (1)

Oleg Komarov
Oleg Komarov il 5 Ago 2011
hist uses histc on line 92:
edit hist
The binning follows the principle [...) and it all depends on how you define the edges.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by