필터 지우기
필터 지우기

Help with histogram physics

조회 수: 5 (최근 30일)
michael
michael 2011년 7월 27일
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
Andreas
Andreas 2011년 8월 5일
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 2011년 8월 6일
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?

댓글을 달려면 로그인하십시오.

답변 (1개)

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

카테고리

Help CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by