| Date | File | Comment by | Comment | Rating |
|---|---|---|---|---|
| 19 May 2009 | choose.m compute number of ways of choosing m objects from n distinct objects | Feldman, Phillip M. | Darren and John- Most of what I do with Matlab is simulation. From the standpoint of a simulationist, nchoosek is probably more suitable in the development/debugging stage of a simulation, but once the development and debugging has been done, one wants the code to run as fast as possible. Below are the results of a simple timing comparison of nchoosek and choose: >> mytime(0); for i=1:1e6; nchoosek(52,13); end; mytime;
>> mytime(0); for i=1:1e6; choose(52,13); end; mytime;
Note that my function runs over four times as fast as Matlab's builtin function. For the user who invokes nchoosek small numbers of times from the command line, the difference in speed is unimportant. But, when nchoosek or choose is being called millions or tens of milions of times from within a program, the difference becomes important. Please let me know if further explanation is required. |
|
| 17 May 2009 | show_colors.m generates a labeled plot showing all colors recognized by RGB.m | Feldman, Phillip M. | Actually, fig is available (separate download). cell2num was missing, but I've submitted it now. |
|
| 13 May 2009 | nextprime For any given number (also vpi numbers), find the next prime number in the sequence of primes. | Feldman, Phillip M. | This code would be more efficient if all values were stored as integers, and all operations were performed on integers. There's no reason to use floating point. Also, the limitation that numbers cannot be larger than 2^32 should be removed. Otherwise, very nice. |
|
| 12 May 2009 | Single-variable linear level finding ("inverse" INTERP1): findX Estimates the XI values at which the dependent variables Y reach a specified level YI. | Feldman, Phillip M. | Your code is amazingly compact, and I like it better than mine. I was actually trying to do something slightly different. For discrete-valued sequences, I'd like to be able to exclude cases where the sequence reaches the target level but does not actually cross it. However, this feature of my code appears to not be functioning correctly. |
|
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.
Contact us at files@mathworks.com