Probability density function calculation from data
Show older comments
I have daily rain data of a particuler area for past 20 years i.e 20 vecotrs of 1*365. My supervisour asked to calculate its pdf(probability density function) and use this function to calculate rain on a particuler day. But, I am unable to code this. I would highly appriciate your help.
Answers (1)
Bjorn Gustavsson
on 12 Jan 2021
Step 1, combine the daily rain-data to a 20-by-365 matrix:
for iY = 20:-1:1
rain_20years(iY,:) = rain_daily{iY}; % You'll have to adjust this to match your data-organisation
end
Step 2: plot, analyze the precipitation for a couple of random days:
plot(1:20,rain_20years([1 3 5 7 11 17],:),'.-')
Have a look at the help and documentation of hist, histogram and ksdensity functions. 20 samples is not much to build up a precipitation-probability from, so you could combine a couple of days (+/-1, 2 days perhaps, you'll have to test) to get some more samples, to do that you might have to reshape the input to the above functions, for that have a look at the help and documentation to reshape
HTH
Categories
Find more on Hypothesis Tests in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!