Plotting daily occurrence of events in a 3 year time span

2 次查看(过去 30 天)
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Geographic Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by