No License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

3.5 | 3 ratings Rate this file 5 Downloads (last 30 days) File Size: 6.39 KB File ID: #1261 Version: 1.0




21 Jan 2002 (Updated )

Speed optimized version of poissrnd

| Watch this File

File Information

Replaces poissrnd.

Improved speed when argument consists of many, wide ranging values.

Required Products Statistics and Machine Learning Toolbox
MATLAB release MATLAB 6.1 (R12.1)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
14 Dec 2006 louisa ip

It's in the MatLab reference; "break is not defined outside a for or while loop. Use return in this context instead." =P

14 Dec 2006 louisa ip

Jarek is right, there are some issues, I'm not sure why the "break" statement doesn't work except maybe the function is expecting an output, so a "return" is needed. Other issues:

1) Rename Poissrnd.m to poissrnd.m, MatLab likes cases to match between the function name and the file, that should fix of Jarek's #4 issue.
2) On line 136, a "(" is misplaced, replace "if prod(size(lambda) == 1)" with "if prod(size(lambda)) == 1". This way, you are comparing the product of the row and column size of lambda to 1. The original line is trying to compare size of lambda to 1, but take the product of the comparison; which is not a correct input argument for "prod".

Other than that, thanks, saved me a trip home getting the file.

09 Aug 2006 jarek tuszynski

Good useful code with many small annoyances. Needs tinkering to get to work. Some problems I run into with R2006a:
1) Error in line 82 a BREAK statement appeared has to be replaced with RETURN.
2) Error in line 136: something about 'prod' is not defined 'logical' values. To fix replace the whole ?prod()? statement with 0.
3) Name conflict with Matlab?s poissrnd ? had to rename function to something else to get to work without warnings.
4) Poissrnd(0) returned NaN while poissrnd(0) returned 0. More changes needed to fix.

After all those changes code worked fine.

Contact us