File Exchange Pick of the Week

Our best user submissions

PLOTREGION

Here’s another entry from our guest picker, John D’Errico, as Doug and I enjoy another week relaxing …

Have you ever wanted to visualize the feasible set from a set of inequalities? It’s perhaps not for everyone, but if you do many optimizations, you will want to do this sometime. Per Bergström gives us the nice utility PLOTREGION. It takes a set of linear inequality constraints plus additional bound constraints, and creates a pretty figure. Even if all you
need to do is make a nice 3d box in a plot, plotregion should be of help.

Sadly, plotregion works only in 2D or 3D. I can accept that for now, at least until my 4-D holographic monitor comes back from the repair shop.

By the way, here is a tip for all of us to follow. Have you ever wanted to publish your favorite function on the file exchange? Before you do, run it through mlint. Mlint will point out a variety of problems that you may never have noticed. Mlint is a great habit to get into. It may show you how to make your code more efficient, or just find those lines that you forgot to terminate with a semicolon. It can also pick up potential problems for the future if you have used a function or programming style that will be obsolete in a coming release.

[Scott’s Note: M-Lint was introduced in MATLAB 7.]

|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.