compute event rate and plot histogram

I have 606,774(1st row means event no.1)events and 11 column data among them 9th column is the 64-bit absolute time of trigger in unix time(accurate to microsecond), I need help to compute events rate by using time stamps and make plot of event rate using mtlab. The time stamps for only 2 event is like,
1388557138250759
1388557138255312

답변 (2개)

dpb
dpb 2014년 6월 11일

1 개 추천

W/o a lot more effort, you'll lose some precision w/ Matlab datenum but for human consumption it may be sufficient.
>> tun=[1388557138250759
1388557138255312];
>> datestr(tun/86400/1000/1000 + datenum(1970,1,1),'ddmmmyyyy hh:MM:ss.fff')
ans =
01Jan2014 06:18:58.251
01Jan2014 06:18:58.255
>> diff(tun)
ans =
4553
>>
Gives the delta-t in microseconds for a sampled timeseries which you can scale as desired.

댓글 수: 2

Chiranjibi
Chiranjibi 2014년 6월 11일
Thanks, but I have 606,774 events each events has different time. Above two time stamp is only for two events. So can you please help me to calculate event rate for all events.
diff(t)
where t is your input column vector.

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

José-Luis
José-Luis 2014년 6월 11일

1 개 추천

If your want to get Matlab serial date number and you don't care about leap seconds, then you could do:
tun=int64([1388557138250759
1388557138255312]);
epoch = datenum(1970,1,1);
numDays = double(tun ./ int64(86400 * 10^6));
remainder = double(mod(tun , int64(86400*10^6))) ./ (10^6*86400);
datevec(epoch + numDays + remainder )

댓글 수: 8

Chiranjibi
Chiranjibi 2014년 6월 11일
Thanks, but I have 606,774 events each events has different time. Above two time stamp is only for two events. So can you please help me to calculate event rate for all events.
José-Luis
José-Luis 2014년 6월 11일
Well, the variable tun can be made to be any size you want. So you have to import the data first.
Chiranjibi
Chiranjibi 2014년 6월 11일
Actually this is for data analysis of nuclear detector. Please take a look this attached file, I able to identify broken channels for all events from column 1-8 (stretcher value. So now I need to compute event rate from this time stamp (9th column is time in microsecond).
tun = int64(strVals(:,9));
epoch = datenum(1970,1,1);
numDays = double(tun ./ int64(86400 * 10^6));
remainder = double(mod(tun , int64(86400*10^6))) ./ (10^6*86400);
datevec(epoch + numDays + remainder )
Chiranjibi
Chiranjibi 2014년 6월 11일
Is that gives us event rate ?is it necessary to use numDays/datevec.... only for event rate?
José-Luis
José-Luis 2014년 6월 11일
How do you calculate the event rate?
Chiranjibi
Chiranjibi 2014년 6월 11일
I have no idea, that's why I'm asking you. Although I got only 6 column from above code.
José-Luis
José-Luis 2014년 6월 11일
Yes, but what is the formula for it? What do you want? How many times a given time stamp occurs? How do you define when two events are equal? You need that to calculate a rate.

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

카테고리

도움말 센터File Exchange에서 Histograms에 대해 자세히 알아보기

질문:

2014년 6월 11일

댓글:

dpb
2014년 6월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by