필터 지우기
필터 지우기

Plotting daily occurrence of events in a 3 year time span

조회 수: 5 (최근 30일)
btåla
btåla 2017년 1월 30일
댓글: btåla 2017년 2월 2일
How can I plot the occurrence intensity ( nr. of events in days) on daily basis, given that I have datetime arrays that include events ranging in a time span of up to 3 year. I have used [Discret,E] = discretize(time_intensity,'month'); and then [Histcount,edges]=histcounts(Discret); and it works ( after changing the XTicks to show monthly periods ) to achieve my goal for monthly basis but I am not able to do it for daily occurrence. I would like to have a plot of such data where on the y-axis I have the nr. of events happened on each day and on the x-axis the time span ( i.e. from Oct. 2013 to Nov. 2016) which is my events period of observation.

채택된 답변

Jayaram Theegala
Jayaram Theegala 2017년 2월 1일
Hello Basmir,
In order to plot the occurrence intensity on daily basis, you can set the 'duration' argument for "discretize" function to 'day' instead of 'month'. You may find the following MATLAB code useful to get started:
if true
time_intensity = datetime(2016, 1,randi(365,1000,1)); %you can use your values instead of this
%filter the dates within the required range
filtered_time_intensity = time_intensity(time_intensity>datetime('Oct-2013') & time_intensity<datetime('Nov-2016'));
[Discret,E] = discretize(filtered_time_intensity,'day');
%Calculating number of bins for "histcounts" function
number_of_days = max(Discret) - min(Discret) + 1;
[Histcount,edges]=histcounts(Discret, number_of_days);
end
I hope this helps.
  댓글 수: 1
btåla
btåla 2017년 2월 2일
Hello Jayaram,
It was much easier than I thought. Anyway, thank you for the response.
Cheers,

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

추가 답변 (0개)

카테고리

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