Hey,(adsbygoogle = window.adsbygoogle || []).push({});

I'm new to MATLAB and was stuck on a problem which requires me to calculate the expectation value of a poisson distribution by summing the probability mass function *k ie P = k*lambda^k*exp(-lambda)/factorial(k) for k= 1 to infinity. I thought of using "for k1:1000 P =... " but then had no idea how to sum the individual results. Any help much appreciated. =)

edit: I think I've sorted it out now by having a sum term initialised before and included into the loop. However, Im finding that if I increase k to above a value of 400 or so, both the answer for the poisson process and the sum become NaN. Surely, the probability should just reach 0 and the expectation value just 5. Is there any way to avoid this?

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Sum function (MATLAB)

Loading...

Similar Threads for function MATLAB |
---|

MATLAB Coding up the step function |

Bi-exponential function fitting in Origin Lab SW |

Mathematica Looping through vectorized functions for a piecewise solution |

Mathematica Cannot do the integral of the Hyper-geometric function? |

Mathematica Cannot Plot This Function in Mathematica |

**Physics Forums | Science Articles, Homework Help, Discussion**