Poisson CDF output is all one value
Show older comments
I'm creating a Poisson distribution. I then want to produce a cdf evaluated at an array of values using this distribution. However, the output of the cdf matlab function when applied to a Poisson distribution is giving me all one value. I can alter that value by changing lambda of the Poisson distribution, but it's still all one and the same.
This is my first time using Poisson distributions in Matlab, so admittedly there is a strong possiblity there is some user error involved here, but after staring at this code and rewriting it for the last two hours I'm stumped.
The code is below, along with a plot of the evaluated cdf over an array that includes 5000 points regularly spaced from 0.00001 to 0.05. The CDF value is roughly 0.95 for all evaluated points, but it should be a nice smooth 'S' shape starting at 0 and climbing up as the XX value increases. Why am I getting this nonsensical output?
Computer is a Dell laptop running Windows 10.
XX = 0.00001:0.00001:0.05;
p = makedist('Poisson','lambda',0.05);
C = cdf(p,XX);
plot(C)

1 Comment
Umar
on 12 Jul 2024
Hi Michael,
My suggestions are listed below. Adjust the lambda parameter to observe changes in the CDF curve. Experiment with different lambda values to achieve the expected curve shape, consider adjusting the range of values in XX to cover a broader spectrum that showcases the CDF curve's behavior more accurately. I also potentially improve the visualization of the Poisson distribution's CDF using your code.
XX = 0.00001:0.00001:0.05;
lambda = 0.05;
C = poisscdf(XX, lambda);
plot(XX, C);
Please see attached plot.

Please let me know if you have any further questions.
Accepted Answer
More Answers (0)
Categories
Find more on Univariate Discrete Distributions 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!