55 views (last 30 days)

the cyclist
on 10 Jan 2019

the cyclist
on 11 Jan 2019

% Set seed for reproducibility

rng default

% Generate poisson-distributed data.

x = poissrnd(5,10000,1);

% Fit a poisson distribution

pd = fitdist(x,'poisson');

% Calculate the theoretical PDF from the fit parameters

x_range = 0:10;

probability_predicted = pdf(pd,x_range);

% Plot histogram and fit

figure

hold on

histogram(x,-0.5:10.5,'Normalization','probability')

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

set(h,'MarkerSize',24)

Andrés F Vásquez
on 4 Dec 2019

the cyclist
on 5 Dec 2019

I'm going to assume you know how to get the values of the statistics. (If not, just google the statistic name along with matlab and you will find that.)

For adding them to the plot, here are a few commands that you could find useful:

- annotation -- add a wide variety of annotations (including textboxes) to a plot
- text -- add text to a plot; not as versatile as annotation, but simpler
- legend -- add legend
- sprintf -- convert a numerical variable to a string, so that it can be used in the above commands

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Sign in to comment.