Software Listing of Author : "Richie Cotton"
- Calculate number of bins for histogram
- License: Shareware
- Price:


Two files are included: CALCNBINS, which calculates the "ideal" number of bins to use in a histogram, using three possible methods. (Freedman-Diaconis', Scott's and Sturges' methods.) HISTX is a wrapper for Matlab's own histogram function HIST, that uses CALCNBINS to choose the number of bins if none is provided. Examples: y = randn(10000,1); nb = calcnbins(y, 'all') % nb = % fd: 57 % scott: 44 % sturges: 15 calcnbins(y) %Uses the middle value from the above % ans = % 44 calcnbins(y, 'fd') % Choose your method % ans = % 57 histx(y) %Plots a histogram using middle method histx(y, 'all') %Plots 3 histograms, using each method
- Publisher: Richie Cotton
- Date Released: 07-03-2013
- Download Size: 10 KB
- Download
- Platform: Matlab, Scripts
- Check the number of arguments to a function
- License: Shareware
- Price:


nargchk is used almost exclusively in one way: error(nargchk(minargs, maxargs, nargin, 'struct')); The third and fourth arguments are always the same, and you always wrap it in an error call. This stupidly simple function saves you typing, and prettifies your code by wrapping the above line into something more readable, namely CheckNumberArgs(minargs, maxargs);
- Publisher: Richie Cotton
- Date Released: 19-04-2013
- Download Size: 10 KB
- Download
- Platform: Matlab, Scripts
- Generate a new function m-file, with documentation (Sripts)
- License: Shareware
- Price:


Having your m-files documented in a standard way (or at all!) is very useful for sharing code between projects, and between people. The trouble is, clicking File -> New -> Function doesn't give you much to go on, and it is very easy to be lackadaisical about writing thorough and consistent documentation. GenerateFunctionMFile() creates a new untitled m-file with placeholder documentation, and opens the file in the editor. GenerateFunctionMFile(true), works as above but prompts you for the name of the function. The layout includes $Author, $Date and $Revision tags, which are automatically completed for you. If you use CVS or SVN as your version control system, then checking in your file will automatically cause these fields to be updated. Since typing is a lot of effort, also included is a function called "new", which is a wrapper...
- Publisher: Richie Cotton
- Date Released: 18-02-2013
- Download Size: 10 KB
- Download
- Platform: Matlab, Scripts
- Geometric standard deviation
- License: Shareware
- Price:


The stats toolbox provides a function to calculate the geometric mean of an array, but a function for the geometric standard deviation is oddly missing. Here is a function to fill that void, with no toolbox required. The function accepts a vector, matrix or N-D array; an optional flag to normalise by N or (N-1); and an optional dimension to calculate the gsd across.
- Publisher: Richie Cotton
- Date Released: 13-02-2013
- Download Size: 10 KB
- Download
- Platform: Matlab, Scripts
- ismonotonic
- License: Shareware
- Price:


ISMONOTONIC(X) returns a boolean value indicating whether or not a vector is monotonic. By default, ISMONOTONIC returns true for non-strictly monotonic vectors, and both monotonic increasing and monotonic decreasing vectors. For matrices and N-D arrays, ISMONOTONIC returns a value for each column in X. ISMONOTONIC(X, 1) works as above, but only returns true when X is strictly monotonically increasing, or strictly monotonically decreasing. ISMONOTONIC(X, 0) works as ISMONOTONIC(X). ISMONOTONIC(X, [], 'INCREASING') works as above, but returns true only when X is monotonically increasing. ISMONOTONIC(X, [], 'DECREASING') works as above, but returns true only when X is monotonically decreasing. ISMONOTONIC(X, [], 'EITHER') works as ISMONOTONIC(X, []). ISMONOTONIC(X, [], [], DIM) works as above, but along dimension DIM. NOTE: Third...
- Publisher: Richie Cotton
- Date Released: 10-06-2013
- Download Size: 10 KB
- Download
- Platform: Matlab, Scripts
- Jitter
- License: Freeware
- Price: 0.00


Jitter adds a small amount of gaussian (white) or uniform noise to a vector, matrix or N-D array. This function is ideal for adding noise to a signal for processing, or generating starting conditions for chaotic functions. The magnitude of the noise is given as either a fraction of the smallest difference between values of the input array, or as a fraction of the range of values of this input array. See picture for an example. This file is based upon the R function 'jitter' by written by Werner Stahel and Martin Maechler, ETH Zurich. See http://stat.ethz.ch/R-manual/R-patched/lib...tml/jitter.html for details of the original. I've added support for imaginary inputs and gaussian noise, which weren't in the original.
- Publisher: Richie Cotton
- Date Released: 10-04-2013
- Download Size: 10 KB
- Download
- Platform: Matlab, Scripts
- Preference tools
- License: Shareware
- Price:


GetPreference and SetPreference provide a programmatic alternative to the Preferences dialog (File -> Preferences). Use these to automatically configure your version of MATLAB to how you like it. (Save on setup time with each new release!) Note that these function rely on undocumented features that may change in future releases. All functions work in R2010a and R2009b, but GetPreference does not work in previous versions.
- Publisher: Richie Cotton
- Date Released: 18-01-2013
- Download Size: 10 KB
- Download
- Platform: Matlab, Scripts
- Set default values
- License: Shareware
- Price:


In order to set default values for variables, I find the start of my functions littered with if nargin < 1 || isempty(x) x = 1; end if nargin < 2 || isempty(y) y = 3; end etc. This is pretty ugly, so I've created a wrapper to prettify it. Honestly, it's so simple that I nearly didn't upload this, but it does make your functions cleaner. Now the above is transformed to SetDefaultValue(1, 'x', 1); SetDefaultValue(2, 'y', 3); Note that there are other ways to set defaults. See http://blogs.mathworks.com/loren/2009/05/0...ction-defaults/
- Publisher: Richie Cotton
- Date Released: 12-03-2013
- Download Size: 10 KB
- Download
- Platform: Matlab, Scripts
- Shortcut tools
- License: Shareware
- Price:


A set of utilities to programmatically manipulate shortcuts (including toolbar shortcuts and help browser favourites). AddShortcut adds a shortcut to the specified group, which by default is the toolbar, e.g. AddShortcut('Tidy', 'close all hidden; clear all; clc;'); RemoveShortcuts removes shortcuts from the specified group, which by default is the toolbar, e.g. RemoveShortcuts([], 'How to Add'); GetShortcuts retrieves the details of existing toolbar shortcuts, and GetShortcutCategories retrieves the categories that those shortcuts are stored in. CopyShortcuts moves shortcuts between categories. AddBrowserFavourite adds a favourite page/command to your help browser favourites list. Note that the functions rely on undocumented MATLAB features which are subject to change. The files all work correctly in R2010a, R2009b, R2009a...
- Publisher: Richie Cotton
- Date Released: 06-05-2013
- Download Size: 20 KB
- Download
- Platform: Matlab, Scripts
