MATLAB: How to contribute a new func/algorithm

contribute new algorithmMATLAB

Hi, If we have a new algorithm, and would like to implement a new function so everyone can use it, how can we contribute it to Matlab? For example, we name it fzero4large, people can type fzero4large(….) and get answers.

Best Answer

If by "everybody", you mean all of your friends who use MATLAB, you need to put it someplace where they can all put it on their search path. They would use the pathtools in MATLAB to add that given directory to their search path, and now they will be able to see your code in MATLAB.
If by everybody, you want your function to become part of MATLAB proper, this is not possible unless you work for TMW and can convince them that your code is worth such an effort.
If you mean that your function will become available to anyone who wants to download it for free, then the file exchange can be a good place, IF you do a few things first.
Please do us all a favor though, DOCUMENT your code. Make is a useful tool that others can use and will want to use. Don't just submit your homework assignment because you got an A on it. Follow standard styles for documentation, and for interaction with the user. Don't use the input command for command line input. Do provide a function that someone can call, rather than a script that begins with the words "clear, clc, close all". Your instructor may want that, but NOBODY else who will want to use your stuff in the real world does, and the file exchange is for real world use.
Make your code robust to problems. Test it well. Provide error checking that will let it survive, returning a meaningful error dialog to help the user understand what they did wrong or what went wrong. Use good numerical techniques, that show you understand the arcane and abstract art of numerical analysis where that is necessary.
If you wish for examples of programming style, look at the tools in MATLAB itself. Emulate their help styles. Or look on the FEX for codes that earn high compliments from professionals. Read the comments and see what factors do make for useful tools.
All of these things make for a useful contribution to the world. I'm not saying that you must do everything I said above. But if you want others to find your work useful, then the above things are ways to help them do their work. And everybody wants to find something to make their lives a bit easier.