Software Listing of Author : "John D'errico"

've written quite a few separate tools to generate a minimal bounding object of some ilk. So if you have a set of points in the plane, and wish to generate the minimal bounding... - rectangle - triangle - general quadrilateral - circle - parallelogram - semi-circle there is a tool in here to solve your task efficiently. You will also find minboundsphere, for 3-d data. Inscribed objects are also supported, computed by incircle and insphere. Caveat - if you have only an image, don't expect these tools to work directly. (The image processing toolbox can do much here anyway - look there first.) In order to use these tools, I require a set of extracted points.

  • Platform: Matlab, Scripts

The arclength function computes the length of a general space curve. This is not too difficult if the curve is assumed to be piecewise linear (a one liner) but if the curve is to be a smoothly interpolated spline, then the problem becomes more difficult. A nice way to solve this problem for the cubic case is to formulate it as a numerical integration, whereupon the solution can be gained from quadgk. Carefully written code breaks the problem into a series of integrals between each pair of breaks on the curve to avoid the derivative singularities one would find otherwise.

  • Platform: Matlab, Scripts

I've seen many people ask for a way to find the closest point on a curve from some given point in space. If the curve is a piecewise linear one, this is not too difficult, since this reduces to finding the closest point on a line segment, and then testing each line segment. (With care, you need not test EVERY line segment.) For a cubic spline however, this becomes more difficult, but still doable in a mathematical sense without an explicit optimization. Not too much more than roots is necessary. Distance2curve allows you to specify a set of general points in an n-dimensional space as a connected space curve. A spline (or pchip) is then fit in terms of arc length along the curve, and the closest point identified.

  • Platform: Matlab, Scripts

Some curve fitting or smoothing tools can benefit from knowledge of the noise variance to expect on your data. Kalman filters use this information, also some spline fitting tools. So I wrote a function to extract the noise variance from a signal vector. It also works on any specified dimension of an array. A few examples of this code in use: Simple linear data, with purely additive N(0,1) gaussian noise: t = 0:10000; x = t + randn(size(t)); mv = estimatenoise(x) mv = 1.0166 Gaussian noise added to a sine wave (Nominal variance = 0.01) t = linspace(0,1,1000)'; x = sin(t*50) + randn(size(t))/10; mv = estimatenoise(x) mv = 0.0096887 Pure gaussian noise, with a nominal variance of 9. (Note that var would have been a better estimator for this particular case...) mv = estimatenoise(3*randn(2,3,1000),3) mv = 9.6584 8.2696 8.632...

  • Platform: Matlab, Scripts

Fminsearch does not admit bound constraints. However simple transformation methods exist to convert a bound constrained problem into an unconstrained problem. Fminsearchbnd is used exactly like fminsearch, except that bounds are applied to the variables. The bounds are applied internally, using a transformation of the variables. (Quadratic for single bounds, sin(x) for dual bounds.) The bounds are inclusive inequalities, which admit the boundary values themselves, but will not permit ANY function evaluations outside the bounds. Note that fminsearchbnd allows the user to exactly fix a variable at some given value, by setting both bounds to the exact same value. Example usage: rosen = @(x) (1-x(1)).^2 + 105*(x(2)-x(1).^2).^2; % unconstrained fminsearch solution fminsearch(rosen,[3 3]) ans = 1.0000 1.0000 % Lower bounds, no upper...

  • Platform: Matlab, Scripts

Nonlinear optimization problems with bound constraints can be solved using FMINSEARCHBND (as well as using many other tools.) For the user who has a problem with linear inequality constraints and/or general nonlinear inequalities as well as bound constraints, FMINSEARCHCON provides a toolbox free alternative, based on FMINSEARCH. FMINSEARCHCON provides a simple, though carefully coded optimization code based on the Matlab provided FMINSEARCH. It uses transformations to deal with the bound constraints, but a penalty function approach to deal with the inequality constraints. The actual objective function is never evaluated outside of the bounds, as the bounds are always tested first. Note that while FMINSEARCHCON does everything that FMINSEARCHBND is capable of and more, I've chosen to provide both these tools independently because...

  • Platform: Matlab, Scripts

I need to thank Duane Hanselman for suggesting this great idea. Fminspleas is a simple nonlinear least squares tool that fits regression models of the form Y = a1*f1(X,C) + a2*f2(X,C) + ... + an*fn(X,C) X can be any array, so it works on multidimensional problems, and C is the set of only intrinsically nonlinear parameters. f1, f2, etc., must return a column vector result, of the same length as Y. Because the optimization (in this case, fminsearch) need only work on the intrinsically nonlinear parameters, far fewer function evaluations are required. The example I give in the help took only 32 function evaluations to estimate 2 linear parameters plus 1 nonlinear parameter, versus over 300 evaluations had I just called fminsearch directly. Fminspleas now allows you to specify bound constraints on the nonlinear parameters only. I'll...

  • Platform: Matlab, Scripts

I am occasionally asked for a 3-d version of my useful inpaint_nans tool. This does it, although I only included the most commonly used methods from inpaint_nans.

  • Platform: Matlab, Scripts

A common request is to interpolate a set of points at fixed distances along some curve in space (2 or more dimensions.) The user typically has a set of points along a curve, some of which are closely spaced, others not so close, and they wish to create a new set which is uniformly spaced along the same curve. When the interpolation is assumed to be piecewise linear, this is easy. However, if the curve is to be a spline, perhaps interpolated as a function of chordal arclength between the points, this gets a bit more difficult. A nice trick is to formulate the problem in terms of differential equations that describe the path along the curve. Then the interpolation can be done using an ODE solver. As an example of use, I'll pick a random set of points around a circle in the plane, then generate a new set of points that are equally...

  • Platform: Matlab, Scripts
  • LSE
  • License: Shareware
  • Price:

This submission was written by request - as a tool to handle linear least squares problems, subject to linear equality constraints that may potentially be rank deficient. (It handles problems with full rank constraints of course too.) In the event of a rank deficient constraint system, it tests for consistency of the constraints. I added a few other features to LSE: - It allows multiple right hand sides to the least squares problem, fully vectorized of course. - Weights may be supplied. - You are offered a choice of least squares solvers, either backslash or pinv. LSE solves the problem (for an unknown vector x) argmin norm(A*x - b) subject to the constraints C*x = d As an example, consider the random system A = rand(10,3); b = rand(10,1); With a rank deficient constraint set C = [1 1 1;1 1 1]; d = [1;1]; X = lse(A,b,C,d) X...

  • Platform: Matlab, Scripts

Occasionally I see a request for computation of a running, windowed standard deviation. This is easily accomplished using filter and the alternative formula for the standard deviation: std = sqrt((sum(x.^2) - n*xbar.^2)/(n-1)). Movingstd allows you to specify forward, backward or central windows of any desired length. It patches the ends, shortening the window as necessary.

  • Platform: Matlab, Scripts

The gradient function in Matlab allows you to compute the slope of a curve along its entire length. But if your curve is a noisy one, then gradient will also be noisy. In this event one might desire to fit a moderately low order polynomial regression model in a sliding window, then differentiate that model. (Like a Savitzky-Golay filter.) All of this can be done efficiently in Matlab using filter. Note that this tool does not constrain the length of the support to be even or odd. Also, this tool uses pinv to generate the filter coefficients - a more stable and accurate methodology than does the sgolay tool on the file exchange. A few examples of movingslope in action: Estimate the first derivative using a 7 point window with first through fourth order models in the sliding window. Note that the higher order approximations provide...

  • Platform: Matlab, Scripts

The art of fitting a nonlinear regression model often starts with choosing a model form. This submission is an attempt to teach the reader a simple but general paradigm for their models as a sum of fundamental shapes that are then shifted and scaled to fit the data. I've included a bestiary of fundamental forms, each of which has been plotted. Each form also has a description of some fundamental characteristics, such as limits and other special values. Who might wish to read this submission? Anyone who is interested in fitting an empirical model to their (1-d) data, although many of the ideas in here are applicable to problems in higher dimensions too. Please e-mail me of any errors I've made, as well as any interesting functional forms that I've failed to include in the bestiary

  • Platform: Matlab, Scripts

New users and old of optimization in MATLAB will find useful tips and tricks in this document, as well as examples one can use as templates for their own problems. Use this tool by editing the file optimtips.m, then execute blocks of code in cell mode from the editor, or best, publish the file to HTML. Copy and paste also works of course. Some readers may find this tool valuable if only for the function pleas - a partitioned least squares solver based on lsqnonlin. This is a work in progress, as I fully expect to add new topics as I think of them or as suggestions are made. Suggestions for topics I've missed are welcome, as are corrections of my probable numerous errors. The topics currently covered are listed below. Contents 1. Linear regression basics in matlab 2. Polynomial regression models 3. Weighted regression models 4....

  • Platform: Matlab, Scripts

Polyfitn is an extension of polyfit, allowing the user to create models with more than one independent variable. It also allows the user to specify a general model, for example, a quadratic model, with constant and quadratic terms, but no linear term. For example, to fit a polynomial model to points selected from a cosine curve, we will only need the even ordered terms. x = -2:.1:2; y = cos(x); p = polyfitn(x,y,'constant x^2 x^4 x^6'); p.Coefficients ans = [0.99996 -0.49968 0.041242 -0.0012079] The coefficients won't be exact of course, as I used only a finite number of terms for what is essentially a truncated Taylor series, and I had only a finite amount of points to build the model from. The exact first 4 coefficients for a cosine series would have been: >> [1 -1/2 1/24 -1/720] ans = 1 -0.5 0.041667 -0.0013889 so we got the...

  • Platform: Matlab, Scripts

(This function was suggested to me as a counterpart to the uigetvar function.) The putvar tool allows you to assign a variable from a function workspace directly into the base workspace. I can envision this tool having value in one of two ways. First, during a debugging session, one might wish to save one or more variables from the function workspace into the base workspace. This way those variables will still exist after the debugger has terminated and you have exited from the function. A second use for this tool is as an alternative way to return a variable (or variables) from a function, possibly a GUI, during the operation of that GUI. As an example of the operation of this code, here is a simple function that uses putvar. Note that you can provide either a variable in the workspace as input, or the name itself of the variable....

  • Platform: Matlab, Scripts
  • License: Freeware
  • Price: 0.00

Some optimization problems have very simple surfaces to optimize. The optimizer simply proceeds downhill to the unique minimizer and returns happily - all is good in the world. Sadly, more often the objective function has multiple local minimizers, you as the user provide poor starting values, and the optimization returns what is essentially junk for a solution. My response would typically be that you needed to provide better starting values. At that time, I'd also try to explain the idea of a basin of attraction for any minimum. Its the set of points that when used as starting values, will allow a given optimizer to converge to a given local minimum. Starting values that lie in the basin of attraction of the global minimizer are not always that easy to choose for all problems. One solution is to use a randomly multiply started...

  • Platform: Matlab, Scripts

Often I see students asking for help on a tool to compute the Fibonacci numbers. Or, I'll find them asking for help on a Project Euler problem. Or, a student has been assigned the problem of computing the fibonacci numbers using a recursive implementation. After all, these numbers lend themselves splendidly to teaching a student to use recursion. The problem is that a direct, simple, recursive scheme is a poor one for the Fibonacci numbers, unless the recursion is written very carefully. This tool teaches you how to compute the Fibonacci numbers in a variety of ways, good, bad, ugly. I teach the concept of memoization, a vitally important tool for many recursive schemes, not only for Fibonacci numbers. (If you do teach a student recursion, use it as an excuse to also teach them about memoization!) Of course, I also employ some...

  • Platform: Matlab, Scripts

Did you ever want the ability to define a special constant that is seen by and used in all of your functions, without needing to create global variables? For example, suppose you used the golden ratio often in your work. Rather than creating a global variable named phi, or being forced to pass a variable around as an argument to your functions, I'll just use defcon to do the work for me. >> defcon('phi',(1+sqrt(5))/2) Here, I used defcon to create a new function called phi on my search path, that acts like the ones and zeros functions. >> format long g >> phi ans = 1.61803398874989 >> phi(1,2) ans = 1.61803398874989 1.61803398874989 phi is now a matlab function, that can be used inside other functions without any further effort. In fact, phi even has help defined, done automatically by defcon. >> help phi phi - User Defined...

  • Platform: Matlab, Scripts
New Reviews

Print Inspector

Whether you are using a printer connected to your local desktop computer or a print server sometimes you need to see whats going on in your printer by having a close look at the print jobs sent by the users. Print Inspector is such type software ...

Disk Genius

Disk Genius was formerly known as Partition Guru which is an all-in-one solution for disk partition management, data recovery and disk repairing. It can recover lost files from partition, backup and restore partition table, clone partition or clone ...

Safe In Cloud

It is quite difficult to find any computer users nowadays who do not need to use the web, for any purpose. Whether it is for education or entertainment, the web is your best resource. You also need to use various online services for banking, ...


Nowadays, a majority of PC users resort to digital image editing once in a while. It may be required for retouching image captured in smart phones or for creating an album in Facebook. For some people, tinkering with digital images is a pastime too. ...

Panda Cloud Cleaner

PC security has become a tricky and complicated subject both for home users and network supervisors, with complexity and risk factors multiplying over the years. Using a single antivirus app may not be enough anymore. That explains why many users ...


Nearly every PC users need to take screenshots from time to time, whether it is for personal or professional needs. While using the basic Windows screenshot capture method is available, it is not adequate for everyone. When you want to capture ...


Dealing with various types of data efficiently holds the key to success in any computing task. Apart from generating new data and modifying existing files, it becomes necessary to delete existing files at times. While most users resort to using ...

New Downloads

Universal Data Access

Universal Data Access
Components is a library of
components that provides
direct access to multiple
databases from Delphi ...

Lodgit Desk Hotel Software
for Mac

Booking software for all kinds
of lodging establishments
incl. reservation schedule,
booking and guest list,
cleaning ...

Tipard DVD Creator

Tipard DVD Creator can burn
DVD disc with any videos in
etc. formats. Besides, it can
help ...

Active@ ISO Burner

Active@ ISO Burner burns
CD/DVD/Blu-ray ISO images
compatible with the ISO 9660
standard. Automated burning is
also ...

ReliefJet Essentials for

A large set of useful and
easy-to-use tools for every
Microsoft Outlook user:
Import, export and convert
using ...

PDF Data Extractor

PDF Data Extractor can extract
certain text information
within the PDF, This is an
ideal product if you had for
example a ...

VideoPad Masters Edition
for Mac

VideoPad Masters Edition for
Mac is a fully featured video
file editor for creating
professional quality videos in

SecureFX for Mac

A highly configurable secure
file transfer client for SFTP,
FTP/TLS, SCP and FTP with
advanced features like site

Raise Data Recovery

Raise Data Recovery is an
efficient utility with an
intuitive wizard-style
interface for effortless
recovery of data from ...

Network Shares Recycle Bin

The Network Shared Recycle Bin
allows you to backup and
recover deleted files on the
server side. Once you have
this tool ...