File Exchange Pick of the Week

June 27th, 2007

Algorithm development video

Here at the MathWorks, one of our Core Values is Continuous Improvement. Part of that is about being process oriented- “Clock building is better than time telling.”

Following that Core Value to talk about algorithm development, it takes more than just looking at finished algorithms (time telling), you need to look at the process of algorithm development (clock building). In that spirit, I wanted to present a new video where I spend fifteen minutes in MATLAB developing an algorithm. You will see every line of code as it is written (and rewritten). Along the way, you will see:

  • Short description of the algorithm to develop
  • Creation and exploration of a test case
  • Initial creation and reworking of the variable naming convention to avoid using “magic numbers”
  • Intermediate testing of algorithm
  • Keeping code clean and readable
  • Use of debugger to understand error messages
  • Use of visualization techniques to understand output
  • Effective use of MATLAB desktop tools

While the topic of the movie is an interesting little algorithm about fractals, the video is more about the process of programming in MATLAB.

Video Content

Find the files here.

6 Responses to “Algorithm development video”

  1. Brian Mintah replied on :

    Doug,
    Can you please post the video in another format, say Windows Media? I am unable to view the shock wave format and currently has new program install constraints on my PC.

    Thanks,
    Brian.

  2. Doug replied on :

    Brian,

    Sure thing. I just updated the zip file to include the .WMV you requested.

    Doug

  3. Andrew Catellier replied on :

    I find it re-assuring to be reminded that everyone has to start from scratch for some things, and that trials are endured by all.

    I do however, find it annoying that MATLAB error messages are still so very cryptic. We really shouldn’t have to enter debug mode to figure out why the subscripted dimension assignment was mismatched. Are we holding on to these messages for the sake of compatibility? Maybe a better message would be “expected matrix output not compatible with matrix element assignment”. Sure, that’s confusing too, but at least the person reading the error would see the red flag “matrix output” and recognize what he was doing.

    And while I’m on my soap box, can we have line numbers for errors thrown when running code in cell mode? How about printing values of loop control variables when errors are thrown from nested loops? I realize there are alternatives, and this may not be the best place to voice my concerns…just sayin’! Seems like these problems would greatly impact the productivity of many, if not all MATLAB users.

    Andrew

    [keyboard mishap edited as per Andrews note- Doug]

  4. Roy Goodman replied on :

    Doug,
    I’ve tried to view this with several different programs on my Powerbook. Each fails in its own way. Could please you post it on youtube as you have some earlier videos.
    Thanks,
    Roy

  5. Doug replied on :

    Roy,

    This was taken at a much higher resolution, it will not fit on YouTube. Sorry, this is the first report of not being able to view the video, anyone else seeing problems?

    Doug

  6. Doug replied on :

    I just changed the resolution and made it in-line. All should be well now.

    Enjoy,
    Doug

Leave a Reply

Wrap code fragments inside <pre> tags, like this:

<pre class="code">
a = magic(3);
sum(a)
</pre>

If you have a "<" character in your code, either follow it with a space or replace it with "&lt;" (including the semicolon).


Bob, Brett & Jiro share their favorite user-contributed submissions from the File Exchange.

  • Zach: Hi Doug and Les, I didn’t have a lot of time to mess with this, but I did find a work-around. I plotted...
  • hamed: k
  • Les: @Zach This isn’t exactly what you are looking for but at least it puts all three parameters on the same...
  • Zach: Thanks for your suggestions Doug. I’ll give that a shot and see what happens. I’ve seen many of...
  • Doug: @Zach, I would say to use plotYYY, because that is close to what you want, but using depth as Y makes sense....
  • Doug: @Teja, I think this will work: http://www.mathworks .com/access/helpdesk /help/techdoc/ref...
  • Gify: merry christmas :) nice christmas tree! Regards, Janet Gify
  • Teja: Dear Doug Is there anyway to plot a surface from nonuniform data without meshgrid and griddata? Basically i...
  • Zach: I’m working with geophysical data, so I’d like to produce a depth profile. The y-axis would be...
  • Doug: @Ashok First, please do not use variable names that are MATLAB commands (std and mean). Second, p(j) should be...

These postings are the author's and don't necessarily represent the opinions of The MathWorks.