Watch this Author's files
If you want to know what's fast, use this:
A moving average does not require to use a for loop at all, and the runtime can be almost independent from window size.
is always false with i not defined as a variable, because it tests the type of the imaginary unit. So getting past line 3 is not the issue, although Duane certainly points to an error in the code.
It's nice to have a real maximize operation without rezising, calling executables or the like. There is one issue, however:
If there is no figure, 'maximize' causes exceptions and makes all subsequent figure or plot operations fail, until the graphic system is sort of reset, e.g. by 'close all'. Tested on R2007b.
It may sound like a joke, but you can draw circles with the standard MATLAB function 'rectangle'. I also wrote a function like you before I found out.