Plotting daily occurrence of events in a 3 year time span
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
btåla
am 30 Jan. 2017
Kommentiert: btåla
am 2 Feb. 2017
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.
0 Kommentare
Akzeptierte Antwort
Jayaram Theegala
am 1 Feb. 2017
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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Geographic Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!