Doug's MATLAB Video Tutorials

August 1st, 2012

Naive vs Complex solutions

This video is more philosophical than about MATLAB syntax. When trying to understand the cycles that occur in the output of a pseudo random number generator, I first approached the problem in easiest way I could think of. It worked well enough for small datasets, but because the computational order of complexity grew by N^2, this did not work very well. It took someone pointing out an algorithm that grew linearly with N to complete the job.

This kind of algorithmic innovation is needed in many cases because the profiler can help you on a line by line basis, but it can not find systematic problems like this.

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).


MathWorks

Doug Hull is a proud MathWorker who is on a mission to help you with MATLAB.

Doug's picture

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