# I am trying to plot poisson density fit to my data x. but it doesnt seem to give the right results

3 views (last 30 days)

Show older comments

%y is seconds

y=[20 50 100 200];

%x1 counts after 20s,x2 couns after 50s, x3 counts after 100s, x4 counts after

%200s

x1=[47 59 56 56 61 54 72 64 53 73 59 62 43 61 63 70 55 59 70 52 62 76 64 68 63];

x2=[129 167 139 154 154 171 167 132 151 139];

x3=[317 297 301 312 329];

x4=[612 598];

%x is detections per second

x=[x1/y(1) x2/y(2) x3/y(3) x4/y(4)]';

% Set seed for reproducibility

rng default

% Fit a poisson distribution

pd = fitdist(x,'poisson');

% Calculate the theoretical PDF from the fit parameters

x_range = 2:3.8;

probability_predicted = pdf(pd,x_range);

% Plot histogram and fit

figure

histogram(x,9)

xlabel('Observation');

ylabel('Probability');

h = plot(x_range,probability_predicted,'-');

set(h,'MarkerSize',24)

##### 5 Comments

Jeff Miller
on 13 Feb 2021

### Answers (1)

Shubham Khatri
on 21 Feb 2021

Hello,

It didnt work because Poisson distribution is a discrete probability distribution of the number of events occurring in a given time period, given the average number of times the event occurs over that time period. It would be good if you can share your data source to find a good fit of a model.

Hope it helps

##### 0 Comments

### See Also

### Categories

### Community Treasure Hunt

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

Start Hunting!