# MATLAB example: Don’t reinvent the thermometer

Posted by Doug Hull,

My last post talked about finding MATLAB code from other people so that you do not have to reinvent it yourself. Eric, the author of the code I modified, challenged me to create “a new Matlab Central submission that uses the thermometer and a urlread of boston.com to make a… read more >>

# MATLAB example: Don’t reinvent the wheel1

Posted by Doug Hull,

I love a good visualization of data, and often cringe when I see data in a table that would be much more effective as a graph. As with many people in Boston today, I am trying to decide what to do about the impending snow storm tomorrow. Last… read more >>

# Puzzler: Intermediate sums6

Posted by Doug Hull,

MATLAB challenges get thrown around the halls of The MathWorks with fair regularity. I thought this most recent one would make a good puzzler.
You have a matrix that has 3xN rows and you want to expand it such that after every third row of the original, you insert a… read more >>

# Video Tutorial: Using visualization to debug3

Posted by Doug Hull,

A question came up on the MATLAB newsgroup about debugging a sorting algorithm. I thought this was an excellent opportunity to show how visualization of intermediate results would help to determine why an algorithm does not work as hoped. This technique of adding intermediate plots as a means of debugging… read more >>

# Video tutorial: 3d indexing4

Posted by Doug Hull,

The MATLAB user has this: clear clc M(:,:,1) = [1,2;3,4]; M(:,:,2) = [21,22;23,24]; J = [1,2; 2,1]; They want this: ans = [1 22 23 4] They tried this: D = M(:,:,J) % This doesn’t work, This video discusses this solution: [nR, nC] = size(J); D = zeros(nR,nC); for r = 1:nR for c = 1:nC … read more >>

# Video tutorial: Verbal code review

Posted by Doug Hull,

Talking through your code is an excellent way to find bugs. By discussing the code you have written line by line, you are forced to understand it better. This is a common practice at most software companies. By talking through this simple function, we are able to find a small… read more >>

# Video tutorial: Tolerances in comparisons4

Posted by Doug Hull,

Sometimes you will do a calculation where the answer looks like ‘0’ or ‘1’ or some other number like that. The natural thing to do is to do a test like this: if (answer == 1) Do something end However, if the calculation was done in double precision, answer… read more >>

# Video tutorial: Infinite series3

Posted by Doug Hull,

In this short video, I explore the math behind this joke: An infinite number of mathematicians walk into a bar. The 1st orders a 1 beer. The 2nd orders 1/2 a beer. The 3rd orders 1/4 a beer. … … read more >>

# Video tutorial: Debugging a logical indexing problem4

Posted by Doug Hull,

I love getting well formed question and challenges from fellow MATLAB users. This week I got one that works very well as a video. The problem was trying to index into a vector with a vector of ones and zeros. While this vector was all ones and zeros, it was still… read more >>

# Contest: Final wrap up2

Posted by Doug Hull,

Well, it was a great contest this season. I was very happy to see that each King of the Hill tended to get arguably better than the prior. I wanted to find out how much better, so I used the actual test suite and the eight different Kings… read more >>