The Convolution Research BlogImpossible Problems. Solved. (And blogged about.)
http://www.convolutionresearch.com/blog
Mon, 09 Sep 2013 16:34:31 +0000http://www.convolutionresearch.com/assets/brandlogo_md-d0972474d0789440a41cec1a3e8c36c0.pngConvolution Research
http://www.convolutionresearch.com/blog
(Not) Posting My Slides<p>Last week I presented a paper at SPIE Optics+Photonics in San Diego. It was a good conference, and I think the people who attended my session were happy with it. (Also thanks to the CalTech and U of Arizona people for a good lunch discussion after the session.)</p>
<p>Here I’m not going to get into the (ongoing) research, but I want to highlight a couple things I did with the slides that you might try in your own presentations.</p>
<p>First, <a href="http://www.convolutionresearch.com/blog/posts/dont-be-boring#comment-1029072167">sorry (long-time friend of mine) Geoff</a>, but I’m not going to post all of the slides. Remember, slides don’t stand alone as a document. In fact, the point of this presentation at the conference was to highlight salient sections of the paper I had already written. So, if anything, I would post the paper.</p>
<p>Now, slide number 1: a plot of diffraction efficiency data generated in <a href="http://www.scilab.org/">Scilab</a>.</p>
<p><img src="https://s3.amazonaws.com/convolution-research-blog-assets/diff_eff_data.png" alt="A slide with a plot"/></p>
<p>A few things to note here:</p>
<ul><li><strong>No bullets.</strong> (And yes, I understand the irony of including this point in a bulleted list.)</li>
<li>The <strong>plot is big</strong> on the page. No clutter around it. It uses all of the available space while leaving some margin so things don’t look too crowded.</li>
<li><strong>There is a title</strong> on the page, but it’s short (and big). By itself, this probably doesn’t make sense, but in the context of the talk, the title serves as a reminder of where we are.</li>
<li>Lines have <strong>colors and textures</strong>. The colors have good contrast vs. white, and show up well on a projector. (Hint: don’t use cyan or yellow.) Also the colors are different enough from each other. Finally, the dashed lines help distinguish the curves if you have issues seeing color or if the plot is printed in black and white (as it is in paper published in the conference proceedings).</li>
<li>There is a <strong>clear, consistent font</strong>. The basic Keynote template I started with uses Gill Sans Light. The smallest non-subscript text is roughly 28pt. And, importantly, the plot axes and legend use the same font as the rest of the presentation.</li>
</ul><p>That last point is not difficult to achieve, but it is time-consuming. Scilab generates good plots, but doesn’t have a lot of flexibility in formatting. Also, I’ve found that if you play around with dashed lines in Scilab, they look fine in the application but don’t export well. Fortunately, Scilab will export <a href="http://en.wikipedia.org/wiki/Scalable_Vector_Graphics">SVG</a> vector graphic files that can be tailored in Adobe Illustrator (or Inkscape or similar) to change fonts, add annotations, change colors, and change dashes. (Caution: The initial vector structure you get will be a mess. But with a little effort, you can split/combine paths and group/ungroup entities to get to something that makes sense.)</p>
<p>Another trick is to keep consistent axis scaling in Scilab as much as makes sense:</p>
<pre><code>--> plot(...);
--> a = gca(); // get current axis
--> a.data_bounds = [xmin, ymin; xmax, ymax];
--> a.tight_limits = "on";
</code></pre>
<p>This way, you can reuse axis formatting–line weight, color, font–across multiple plots in your presentation. (It also helps the audience understand relative scales between data sets.) And finally, keeping everything in a vector format as long as possible maintains image fidelity when you resize in the presentation slide.</p>
<p>Now slide number 2 (and 3): a full-bleed photograph of part of the lab setup.</p>
<p><img src="https://s3.amazonaws.com/convolution-research-blog-assets/lab_context.jpg" alt="Full bleed photo with context"/></p>
<p>Large photos are great, obviously, for illustrating things that are difficult to describe (like an experimental lab setup). The first photo has the room lights on, and when this slide is up, I can describe the position of the holographic plate on the rotation stage, the location of the laser source, etc. But it is difficult to see the two diffraction spots on the screen. However, when I include another photo taken from the same position with the room lights off, you can easily see the diffraction spots.</p>
<p><img src="https://s3.amazonaws.com/convolution-research-blog-assets/lab_contrast.jpg" alt="...and the same scene with contrast"/></p>
<p>You can’t see the apparatus well anymore in the second picture, but that doesn’t matter because context was established in the previous slide. When the slideware–Keynote in this case–dissolves between the photos, connection between the two is obvious, and that can be worked into the description during the fade: “The output spots are easier to see once we turn the room lights off.”</p>
<iframe width="420" height="315" src="//www.youtube.com/embed/I9LxmtU1I0E" frameborder="0"></iframe>
<p>(Also, don’t forget to practice with technology interruptions. My presenter display–showing the next slide and a timer–decided not to work during the presentation. My laptop display was just mirroring the projector, and there wasn’t time to fix it. Things still went reasonably well.)</p><img src="http://feeds.feedburner.com/~r/TheConvolutionResearchBlog/~4/x9kcyKDCdOA" height="1" width="1" alt=""/>Mon, 09 Sep 2013 16:34:31 +0000
http://feedproxy.google.com/~r/TheConvolutionResearchBlog/~3/x9kcyKDCdOA/not-posting-my-slides
http://www.convolutionresearch.com/blog/posts/not-posting-my-slidesGreg Ingersollhttp://www.convolutionresearch.com/blog/posts/not-posting-my-slidesWhat Did You Break?<p>I recently worked on a consulting project where I was brought in to carry some embedded software across the finish line. There was more work than they originally thought–not an uncommon sentiment–and the timeline was growing increasingly critical. (When isn’t it?).</p>
<p>The project seemed straightforward on the surface. “We have a legacy machine and legacy code base. We need to update the processor because we can’t get the old one anymore. So we also need to update the firmware because a lot of it is hardware dependent.” No sweat. No surprises here. Code in in C, so it’s reasonably portable. Find the hardware-dependent parts, extract and modularize, port, verify.</p>
<p>Except…</p>
<p>There were no requirements. And there was no version control implemented (unless you consider dated, initialed comments version control–hint: it’s not). But worst of all, another software engineer with the best of intentions decided that the legacy code was poorly organized and needed to be completely rearchitected.</p>
<p>First, he was right. Those hardware-dependent parts: everywhere. No modularity. And what modularity there was depended heavily on Ctrl-C/Ctrl-V: copy and paste running rampant. If good code is DRY (Don’t Repeat Yourself–hint: it is), this code was a fire hose trained on the Pacific Ocean. Global variables ruled the day. Comments were needed because object naming was nigh unintelligible. But the existing comments–when not used as a poor substitute for version control–were not kept up to date, so they did more harm than good. (Pro-tip: please stop bothering with comments unless you’re writing in assembly; I want to read your code not your comments.)</p>
<p>But second, he was dead wrong. Remember, no requirements. The code base had no associated functional or unit tests. The whole system only had an end-of-line test plan. The legacy machine was the design documentation, and the fact that customers liked it and wanted the revision to act the same was the pass/fail criterion.</p>
<p>You are not–repeat not–allowed to refactor code in this situation.</p>
<p>You don’t know the impacts. You can’t test the changes. You have no idea what you just broke. This is a stopgap project to keep the assembly line going until the next gen is released. This is not your Mona Lisa or Empire State Building or Saturn V.</p>
<p>There is one course of action: Click Compile. Fix hardware- or toolchain-related syntax error. Repeat.</p>
<p>The end result isn’t pretty and it’s not maintainable. But neither was the starting point. Step away from the editor (i.e. vi), the schematic/layout suite, the solid modeling tool, the #2 pencil, the screwdriver…whatever. The goal is to ship an almost exact copy. It doesn’t have to be pretty; your customer doesn’t care. It has to ship on time and on budget (your customer definitely cares about this).</p>
<p>All that being said, though, please don’t run your development this way. Don’t get into this situation. Write requirements and tests. Get early buy-in. Use automated testing for software–it’s just more software–so you can refactor and optimize to your heart’s content. Documentation costs money, sure. Useful documentation anyway, and it saves more than it costs.</p>
<p>Know where you’re going before you start walking, and you’ll have a maintainable, efficient system that will be more profitable in the long run.</p><img src="http://feeds.feedburner.com/~r/TheConvolutionResearchBlog/~4/35TQPv3ONTQ" height="1" width="1" alt=""/>Tue, 03 Sep 2013 19:11:10 +0000
http://feedproxy.google.com/~r/TheConvolutionResearchBlog/~3/35TQPv3ONTQ/what-did-you-break
http://www.convolutionresearch.com/blog/posts/what-did-you-breakGreg Ingersollhttp://www.convolutionresearch.com/blog/posts/what-did-you-breakDo Be Relevant<p>Following up from my <a href="http://www.convolutionresearch.com/blog/posts/dont-be-boring">earlier post</a> covering resources for building effective presentations, I thought I’d throw a few more out there. These are not about presentations so much as about general effectiveness. I’ve read all of these–most multiple times–and I find them eye-opening and engaging and helpful. So if you’re a manager, and employee, an academic, a free-lancer, whatever, you’ll probably get something good out this list.</p>
<ol><li><a href="http://www.amazon.com/exec/obidos/ASIN/1591843162/permissionmarket"><em>Linchpin</em></a> by Seth Godin. Are you indispensable? It’s a good place to be, and you can get there. But also be careful. Being the only person in your organization who knows your product or technology doesn’t mean you can’t be replaced. Like most of Godin’s work, this is an interesting read about how you can be sustainably indispensable and relevant.</li>
<li><a href="http://www.amazon.com/Drive-Surprising-Truth-About-Motivates/dp/1594484805/"><em>Drive</em></a> by Daniel Pink. Autonomy, Mastery, and Purpose. You want the freedom to be creative and the responsibility that comes with it. You want to be great at what you do. You want what you do to mean something. These are the things that get you out of bed in the morning. Are you getting them?</li>
<li><a href="http://www.amazon.com/Dip-Little-Book-Teaches-Stick/dp/1591841666"><em>The Dip</em></a> by Seth Godin. A short and sweet gem from Godin—subscribe to <a href="http://sethgodin.typepad.com/">his blog</a> while you’re at it. How do you know when your idea is draining your resources? And how do you know if you should push through or abandon? (Over the course of my Ph.D. research, I’ve read this several times.)</li>
<li><a href="http://assets.sbnation.com/assets/1074301/Valve_Handbook_LowRes.pdf"><em>The Valve Handbook for New Employees</em></a>. An interesting take on organizing a relatively small company of highly-motivated people. (Side note: why do you have people who are not highly-motivated?)</li>
</ol><p>…and a few more quick ones:</p>
<ol><li><a href="http://books.google.com/books/about/The_Non_Designer_s_Design_Book.html?id=n1AuwXafMO8C"><em>The Non-Designer’s Design Book</em></a> and <em>The PC/Mac is not a Typewriter</em> by Robin Williams.</li>
<li><a href="http://www.businessmodelgeneration.com/">Business Model Generation</a></li>
<li><a href="http://www.escapefromcubiclenation.com"><em>Escape from Cubicle Nation</em></a> by Pam Slim.</li>
<li><a href="http://personalmba.com/"><em>The Personal MBA</em></a> by Josh Kaufman.</li>
</ol><img src="http://feeds.feedburner.com/~r/TheConvolutionResearchBlog/~4/lE5KAh6CVRw" height="1" width="1" alt=""/>Mon, 29 Jul 2013 15:13:53 +0000
http://feedproxy.google.com/~r/TheConvolutionResearchBlog/~3/lE5KAh6CVRw/do-be-relevant
http://www.convolutionresearch.com/blog/posts/do-be-relevantGreg Ingersollhttp://www.convolutionresearch.com/blog/posts/do-be-relevantSwedish Origami<p>I recently <a href="http://www.convolutionresearch.com/blog/posts/they-call-him-mr-gibbs">posted</a> a <a href="http://www.convolutionresearch.com/blog/posts/call-it-even-or-odd">few</a> <a href="http://www.convolutionresearch.com/blog/posts/broken-symmetry-and-fourier-transforms">articles</a> about Fourier decomposition, and I often get asked–and ask myself–“How do I calculate that again?” using a tool like Matlab or (my preference) its open-source cousin, <a href="http://www.scilab.org/">Scilab</a>. Just how we change a data set sampled in time to one sampled in frequency is straightforward. We run the Fast Fourier Transform algorithm:</p>
<pre><code>--> y=fft(x);
</code></pre>
<p>Easy. But what if you want to actually understand the data and do something with it? The problems with not knowing how to tailor the output of this calculation are best illustrated with some plots. In Scilab, let’s generate a basic audio signal with two tones sampled at 44.1kHz. First we create an axis consisting of 1024 evenly spaced points in time. A sample rate of 44.1kHz–the CD audio rate–means the sample times are separated by a bit less than 23 microseconds. (Note: this example code works with Scilab 5.4.0 on OSX, your mileage may vary.)</p>
<pre><code>--> N = 1024;
--> fs = 44100;
--> t = (1/fs)*(0:1:(N-1));
</code></pre>
<p>Then we create two sine waves with frequencies of 5000Hz and 10000Hz and different amplitudes (1 and 2), add them together, and plot the result.</p>
<pre><code>--> f1 = 10000;
--> a1 = 1;
--> y1 = a1*sin(2*%pi*f1*t);
--> f2 = 5000;
--> a2 = 2;
--> y2 = a2*sin(2*%pi*f2*t);
--> y = y1 + y2;
--> plot(t, y);
</code></pre>
<p>After zooming in on the plot, we get something that looks like this:</p>
<p><img src="https://s3.amazonaws.com/convolution-research-blog-assets/swedish_origami1.png" alt="The Input Signal"/></p>
<p>Taking the Fourier transform and plotting:</p>
<pre><code>--> Y = fft(y);
--> plot(Y);
</code></pre>
<p>gives this:</p>
<p><img src="https://s3.amazonaws.com/convolution-research-blog-assets/swedish_origami2.png" alt="The FFT Samples"/></p>
<p>which looks interesting, but it’s not terribly useful. First, we don’t have a frequency axis, just numbered samples. Second, we expect a delta function–a spike (technical term)–for each sine wave, but we see four spikes instead of two plus some negative-going add-ons. And the amplitudes are all messed up; the spikes are too tall.</p>
<p>Second thing first. The result of the FFT is a series of complex numbers, and if you give that to the plot function, Scilab plots the real part by default. In most applications, we’re not interested in real and imaginary parts but rather amplitude and phase. Antennas and image sensors (<a href="http://www.convolutionresearch.com/blog/posts/resolving-eye-shapes">eyes</a>) and microphones (ears) and speakers and… often only care about <em>intensity</em>, or amplitude-squared; even the phase information is ignored. So for now, let’s plot the amplitude of the FFT using the complex absolute value function.</p>
<p>At the same time, let’s add a proper frequency-axis to the plot. The nature of the FFT is such that the 0th sample is DC or a frequency of 0, and the highest frequency is just less than the sampling frequency. What does “just less” mean? Well, the sample spacing is such that if you extended the sequence by one sample, the Nth point would be the sampling frequency (but because we’re zero referenced, the (N-1)th point is the last one.) An easy way to handle this is:</p>
<pre><code>--> f = linspace(0, fs, N+1); // one sample too many
--> f = f(1:$-1); // drop the last sample
</code></pre>
<p>The final trick is to divide by N to scale the amplitude correctly–I always forget that bit, so now I’ve written it down. Now if we plot the scaled amplitude of the FFT vs. our frequency axis</p>
<pre><code>--> plot(f, abs(Y)/N);
</code></pre>
<p>we get:</p>
<p><img src="https://s3.amazonaws.com/convolution-research-blog-assets/swedish_origami3.png" alt="FFT Amplitude vs. frequency"/></p>
<p>Hmmm, still four spikes instead of two. And we started with amplitudes of 1 and 2, not 0.5 and 1, so the scaling is still wrong. Or is it?</p>
<p>There are two ways to look at this. First, from a <a href="http://en.wikipedia.org/wiki/Fourier_transform">Fourier transform table</a>, the transform of a sine function of frequency f is a delta function at f <em>and</em> one at -f each with <em>half the amplitude</em>. So if we move the right half of our plot to the left and shift the axis to include negative frequencies:</p>
<pre><code>--> plot(f-(fs/2), fftshift(abs(Y)/N));
</code></pre>
<p>the plot looks like this:</p>
<p><img src="https://s3.amazonaws.com/convolution-research-blog-assets/swedish_origami4.png" alt="FFT Amplitude vs. frequency centered at DC"/></p>
<p>Now we have spikes of amplitude 1–half the original 2–at 5000Hz and -5000Hz, and spikes of amplitude 0.5 at 10000Hz and -10000Hz, just like we expect. (Note that the amplitudes are slightly less than these values, and the spikes flare at their bases. This is a topic for another time, but it’s related to <em>windowing</em> with a rectangle…or convolving with a sinc.)</p>
<p>The other way of looking at the result is to re-examine the unshifted plot and note that the high-frequency spikes are at 39100Hz and 34100Hz. Not coincidentally, these frequencies are the sampling frequency (44100Hz) minus the frequencies of interest (e.g. 44100-5000=39100). The FFT plot is a mirror image folded–origami, get it?–at one-half the sampling frequency. Half the sampling frequency is often called the Nyquist frequency (<a href="http://en.wikipedia.org/wiki/Harry_Nyquist">Harry Nyquist</a> was Swedish, and with folding we’ve resolved this post’s title). The theory says that this is the highest frequency that can be reconstructed from the sampled signal without <em>aliasing</em>. This is also a topic for another time, but here’s a taste.</p>
<p>Let’s keep the 44100Hz sampling rate, but feed it a 30000Hz signal.</p>
<pre><code>--> z = sin(2*%pi*30000*t);
--> plot(f-(fs/2), fftshift(abs(fft(z))/N));
</code></pre>
<p><img src="https://s3.amazonaws.com/convolution-research-blog-assets/swedish_origami5.png" alt="Aliased Signal vs. frequency centered at DC"/></p>
<p>Again we see the characteristic spikes at positive and negative frequencies, but the frequency is not 30000Hz. In fact, it is 44100-30000=14100Hz. So if you record a 30kHz tone at a 44.1kHz rate and play it back, the signal will manifest itself as a tone with a bit less than half the original frequency!</p>
<p>This is fundamental theory that is applied regularly to countless systems: audio, video and imaging, communications, biometric sensors, … While the math and the tools are relatively simple, reality makes the engineering more difficult. Keep on eye on this blog for more.</p><img src="http://feeds.feedburner.com/~r/TheConvolutionResearchBlog/~4/hDsTu_MNwE4" height="1" width="1" alt=""/>Thu, 18 Jul 2013 20:58:13 +0000
http://feedproxy.google.com/~r/TheConvolutionResearchBlog/~3/hDsTu_MNwE4/swedish-origami
http://www.convolutionresearch.com/blog/posts/swedish-origamiGreg Ingersollhttp://www.convolutionresearch.com/blog/posts/swedish-origamiDon't Be Boring<p>I have a <a href="http://spie.org/x13194.xml">conference</a> coming up, so I’ve been thinking again about what makes a good presentation. This is a difficult question to answer, and it’s probably easier if you think about the converse at the same time: what makes a bad presentation? Here are a few concepts I’ve picked up over the years.</p>
<ol><li><strong>Don’t be Boring</strong> I’m stealing this from Ben Orenstein of <a href="http://www.thoughtbot.com/">thoughtbot</a> and host of their <a href="http://learn.thoughtbot.com/podcast">podcast</a>. It’s pretty simple. To transfer ideas and information, the audience needs to be interested and engaged.</li>
<li><strong>A Presentation is not a Document</strong> If you can convey what you need to convey in a document, then format the information as a document and email it to me; no scheduling necessary. Also, don’t hand out your slides before-hand…or ever. Supplementary materials should be sent after the presentation so people can pay attention during. And contrary to popular belief, your slides should not stand alone. They should enhance what you are saying. If your slides do stand alone, just format them as a document and cancel the meeting (see also #4).</li>
<li><strong>Clipart</strong> No. Just no.</li>
<li><strong>Bulleted Lists</strong> What is the maximum number of bullets per slide? How about zero. I didn’t go to your presentation to watch you read, and I can’t listen to you and read the screen at the same time. If you’re just going to read, see #2 (and beware of infinite referential loops). Also regarding (not) reading, when you practice have a friend randomly turn off the display. Can you keep going seamlessly?</li>
<li><strong>Slides are Cheap</strong> Long, long gone are the days when “creating slides” literally meant creating semi-transparent film for an overhead or slide projector. You don’t need to try to cram everything onto 3 slides. You should not (and cannot) gauge the length of your presentation by counting slides; only by practicing delivering it (tip: use a video camera; you have one on your phone). And bonus tip for managers: never say, “put together a slide for the company meeting.” Instead, describe what information needs to come across, and provide a target duration.</li>
</ol><p>Sometimes you can get over a creative block and ultimately create a more memorable presentation by enforcing limits on yourself. Consider these two formats. (Several cities have events organized around these.)</p>
<ol><li><a href="http://en.wikipedia.org/wiki/PechaKucha"><strong>Pecha Kucha</strong></a> Twenty slides displayed for twenty seconds each.</li>
<li><a href="http://en.wikipedia.org/wiki/Ignite_(event)"><strong>Ignite</strong></a> Twenty slides displayed for fifteen seconds each and auto-advancing.</li>
</ol><p>Here are some valuable resources:</p>
<ol><li><a href="http://www.presentationzen.com/"><em>Presentation Zen</em></a> by Garr Reynolds. Also the author of <em>Presentation Zen Design</em> and <em>The Naked Presenter</em>. Reynolds is a strong proponent of using full-bleed photographs to help your audience remember key ideas. Beautiful imagery is memorable and enjoyable, and it’s not as expensive as you think it is. (Looking unprofessional and/or being ignored <em>is</em> expensive.) Also, design your presentations in analog; use whiteboards/post-its and get away from the laptop.</li>
<li><em>slide:ology</em> by <a href="http://www.duarte.com/portfolio/">Nancy Duarte</a>. Also the author of <em>Resonate</em>. Both excellent books covering the design of a presentation in terms of effectively conveying an idea as well as designing its colors, photos, typography, and (tasteful) animation.</li>
<li><a href="http://modernmeetingstandard.com/the-book/"><em>Read This Before Our Next Meeting</em></a> (a.k.a. The Modern Meeting Standard) by Al Pittampalli. In short, make your meetings effective, and don’t have a meeting if you don’t need one. This works for all kinds of meetings, not just for presentations.</li>
<li><a href="http://heathbrothers.com/books/made-to-stick/"><em>Made to Stick</em></a> by Chip and Dan Heath. This includes wealth of ideas about ideas. Specifically “why some ideas survive and others die.” A good read, and a good resource for developing any idea, not just for presentations.</li>
<li><a href="http://www.guykawasaki.com/enchantment/"><em>Enchantment</em></a> by Guy Kawasaki, author of many other excellent books as well. <a href="http://www.guykawasaki.com/the-art-of-the-start/"><em>The Art of the Start</em></a>, in fact is the source of another favorite tip: the 10-20-30 rule. To help your pitch to land: ten slides, twenty minutes, thirty-point font.</li>
</ol><p>And for the scientists and researchers out there who need to present data, look into the excellent books by <a href="http://www.edwardtufte.com/tufte/">Edward R. Tufte</a>. These are great, but dense and not inexpensive. Consider borrowing a copy to start or attend his one-day course; it’s really good.</p>
<p>Finally, some comic relief:</p>
<iframe width="500" height="280" src="https://www.youtube.com/embed/lpvgfmEU2Ck?feature=player_embedded" frameborder="0" allowfullscreen></iframe><img src="http://feeds.feedburner.com/~r/TheConvolutionResearchBlog/~4/6L_uFwd4KV8" height="1" width="1" alt=""/>Tue, 25 Jun 2013 19:45:00 +0000
http://feedproxy.google.com/~r/TheConvolutionResearchBlog/~3/6L_uFwd4KV8/dont-be-boring
http://www.convolutionresearch.com/blog/posts/dont-be-boringGreg Ingersollhttp://www.convolutionresearch.com/blog/posts/dont-be-boringCitation Needed<p>You may have noticed in some recent posts that I’ve linked several times to <a href="http://wikipedia.org">Wikipedia</a>. This maybe raises two questions. First, is Wikipedia a legitimate resource for scientific citation? Then, is Wikipedia a learning tool?</p>
<p>To the first question, I would say “yes, but…” Certainly, you have to be careful of any source, and you have to review the standards of your particular medium if they exist. To wit: I have no issue referencing accurate info in Wikipedia for a blog post, but I may reference a standard text instead for an article in a refereed journal. (In the latter case, reluctance stems from the mutability of Wikipedia; it can change at any time and the reference may no longer make sense.)</p>
<p>To the second question, I say “no, but…” Unfortunately, the same can be said of most textbooks. They are less learning tool and more reference volume primarily due to lack of context. I use Wikipedia as an always available reference for:</p>
<ul><li>reminding me of details to things I already know (like <a href="http://en.wikipedia.org/wiki/Fourier_transform">Fourier Transform Pairs</a> or <a href="http://en.wikipedia.org/wiki/List_of_trigonometric_identities">Trig Identities</a>)</li>
<li>getting a quick overview of something that I might want to investigate more deeply (e.g. <a href="http://en.wikipedia.org/wiki/Hyperspectral_imaging_system">Hyperspectral Imaging</a>)</li>
<li>shutting up my brain by looking up minutiae (<a href="http://en.wikipedia.org/wiki/Wisconsin#State_symbols">it’s the honey bee</a>)</li>
</ul><p>So in a way, I am learning things, but not always with context. Not in a way where I can see the application and the path forward. Adding some context is part of what I am trying to do with this blog; not just regurgitating facts from Wikipedia. Leave some comments if it isn’t–or is–working.</p>
<p>(And xkcd fans, don’t miss the <a href="http://what-if.xkcd.com/47/">citation gag in the recent what-if</a>.)</p><img src="http://feeds.feedburner.com/~r/TheConvolutionResearchBlog/~4/UViPdFgp0GQ" height="1" width="1" alt=""/>Tue, 04 Jun 2013 16:00:32 +0000
http://feedproxy.google.com/~r/TheConvolutionResearchBlog/~3/UViPdFgp0GQ/citation-needed
http://www.convolutionresearch.com/blog/posts/citation-neededGreg Ingersollhttp://www.convolutionresearch.com/blog/posts/citation-neededBroken Symmetry and Fourier Transforms<p>Two <a href="http://convolutionresearch.com/blog/posts/they-call-him-mr-gibbs">previous</a> <a href="http://www.convolutionresearch.com/blog/posts/call-it-even-or-odd">posts</a>
began the discussion of using the Fourier series to break down a periodic signal into constituent sine/cosine waves. Now, to finish that up, we can look
at a general case that varies both the phase and the duty cycle of the example square wave. Recall from
<a href="http://www.convolutionresearch.com/blog/posts/call-it-even-or-odd">last time</a> that shifting a square wave by an arbitrary amount would move energy between
the constituent cosines and sines, but that we never saw any energy in the even harmonics. The reason for this becomes clear if instead of looking at the
Fourier series, we look at the Fourier Transform and employ a couple useful identities.</p>
<p>We use the <a href="http://en.wikipedia.org/wiki/Fourier_transform">Fourier Transform</a> to convert a signal between two domains, say time and frequency—although
you also often use space and spatial frequency in optics. In this way, it is a generalized form of the Fourier series we have been discussing. The Fourier
series breaks down periodic functions into sines and cosines of various frequencies and amplitudes. The Fourier Transform does the same thing for arbitrary
signals resulting in amplitudes as a function of frequency.</p>
<p>The two processes also use the same basis although the Fourier transform is often written to use complex exponentials, and the resulting function represents
complex amplitudes. But this is just the same thing as the Fourier series! A complex exponential can be written as:</p>
<p>$$ e^{j \theta} = \cos \theta + j \sin \theta $$</p>
<p>…so we can equivalently say that the <em>a</em> coefficients—on the cosine terms—of the Fourier series represent the same thing as the real part of the
Fourier transform, and the <em>b</em> coefficients represent the imaginary part.</p>
<p>Back to the square wave. But instead of a square wave, let’s think of this as a combination of three functions. Looking at one period, we have a square
pulse, a.k.a. a rect function. A rect function typically ranges from 0 to 1, so the rect is scaled by 2x and it is shifted down. That constant shift is the
second function. And finally, the pulse happens periodically, so we can write this as a <a href="http://en.wikipedia.org/wiki/Convolution">convolution</a> (lower case)
with a <a href="http://en.wikipedia.org/wiki/Dirac_comb">Dirac comb</a>, a series of delta functions, infinitesimally thin spikes. Convolving a function with a comb
basically makes a copy of the function at each tooth of the comb.</p>
<p>The next figure illustrates this for our square wave. The square wave is in grey; two times the rect (with a width, w, of pi) is in blue; the Dirac comb
(with a period, T, of 2 pi) is in red; and the constant offset of -1 is in green.</p>
<p><img src="https://s3.amazonaws.com/convolution-research-blog-assets/broken-symmetry1.png" alt="Square Wave as a Convolution"/></p>
<p>We can write the function as:</p>
<p>$$ y(t) = 2 \text{rect}\left(\frac{t}{w}\right) \ast \Delta_T(t) - 1 $$</p>
<p>and using some rules of Fourier transforms—and a <a href="http://en.wikipedia.org/wiki/Fourier_transform#Tables_of_important_Fourier_transforms">table of transforms</a>—we
can easily write the function’s transform. First, the constant becomes a delta function—one component of a comb—at zero and pointing down because it is negative
1. The rect becomes a sinc function which is a sine divided by its argument, and the argument is given by the width, w, of the rect. The comb becomes a comb
with a spacing of 1/T instead of T. For the operators, addition and scaling stay the same, but the convolution becomes multiplication. This—with the rest of the
details filled in—gives:</p>
<p>$$ Y(f) = 2 \frac{w \sin(\pi w f)}{\pi w f} \times \frac{\Delta_{1/T}(f)}{T} - \delta(f) $$</p>
<p>These constituents are shown in the top half of the next figure. The sinc (multiplied by 2 and divided by T) is in blue; the comb—not divided by T because
we divided the sinc by T for visibility—in red; and the solitary delta function in green. The lower half of the figure shows everything put together.
Notice how the resulting function is only non-zero where it coincides with the comb and that the sinc (in grey) represents an amplitude envelope.</p>
<p><img src="https://s3.amazonaws.com/convolution-research-blog-assets/broken-symmetry2.png" alt="Constituent Fourier Transforms"/></p>
<p>Also notice that every other piece of the comb sits at the same frequency as the zero-crossings of the sinc. This explains why we only saw odd harmonics before.
The zeros of the sinc sit where the argument of the sine is a multiple of pi or, in this example, with a spacing of 1/w. Because we have a 50% duty-cycle, w is half the period, T,
so the zero spacing is 2/T. This is twice the spacing of the comb, so every other harmonic coincides with a zero of the envelope.</p>
<p>Finally, note that the combination of the sinc, comb, and solitary delta at frequency 0 is zero. f=0 represents a constant, or average value—a DC
offset if you’re an electrical engineer. Because of the 50% duty cycle, the average value of our square wave is Y(0)=0.</p>
<p>Now let’s wrap up with a picture of what happens when the duty cycle is not 50% and we have an arbitrary shift in the square wave. We’ll have a
non-zero average value, and we’ll have a non-zero values for all of the <em>a</em> and <em>b</em> coefficients of the of the Fourier series.</p>
<p><img src="https://s3.amazonaws.com/convolution-research-blog-assets/broken-symmetry3.png" alt="Example with Even Harmonics"/></p>
<p>The top half of the plot shows the square wave (black), the sum of the first ten harmonics (blue), and the sums of the first several odd and even harmonics
(green and red). The lower half shows the frequency space representation with the amplitudes of the cosine and sine coefficients—or equivalently the
real and imaginary parts of the Fourier transform. (The relative amplitudes of the real and imaginary parts are controlled by time-shifting the wave: a
time shift is the same as convolving with a single delta function positioned away from t=0, and this is the same as multiplying by a complex exponential—a pure phase
term—in the frequency domain.)</p>
<p>So that was kind of a long road over three posts, and it may not seem very practical yet. But understanding transitions between time and frequency and basic
Fourier transform properties—especially the convolution-multiplication duality—are fundamental to countless engineering problems in analog and digital
signal processing, wireless communication, and optics. (Lenses can do Fourier transforms in space). An upcoming post will look at how understanding these
principles helped us find the source of unwanted emissions from a motor drive circuit, so stick around for that.</p><img src="http://feeds.feedburner.com/~r/TheConvolutionResearchBlog/~4/4rEB4lCer-Y" height="1" width="1" alt=""/>Mon, 20 May 2013 20:19:00 +0000
http://feedproxy.google.com/~r/TheConvolutionResearchBlog/~3/4rEB4lCer-Y/broken-symmetry-and-fourier-transforms
http://www.convolutionresearch.com/blog/posts/broken-symmetry-and-fourier-transformsGreg Ingersollhttp://www.convolutionresearch.com/blog/posts/broken-symmetry-and-fourier-transformsCall it! Even or Odd?<p>In my earlier <a href="http://convolutionresearch.com/blog/posts/they-call-him-mr-gibbs">post about Mr. Gibbs</a> I discussed
using the Fourier series to break down a periodic signal into consitituent sine waves. The example was a 50%
duty-cycle square wave, and, as it happens, the Fourier series only included sine terms and only included every
other one. Real world signals tend not to be so uniform, and now I want to take a quick closer look at what happens
when you break the symmetry.</p>
<p>The first step is straightforward. The earlier square wave was defined as having a transition at t=0 (assuming
the signal is a function of time, t). Likewise, sin(t) also transitions through zero at t=0, but cos(t) is has a maximum
at 0. So the square wave is in-phase with a sine function, and only exhibits non-zero <em>b</em> coefficients—the coefficients
of the sine harmonics—as shown in the following plot.</p>
<p><img src="https://s3.amazonaws.com/convolution-research-blog-assets/call-it1.png" alt="Sine-like square wave and its harmonics"/></p>
<p>But if we shift the square wave by one-quarter period, the center of one of its lobes will be at t=0, similar to
a cosine. Also, by definition, shifting a sine by a quarter period gives you a cosine. Together this suggests
that the shifted square wave is in phase with a cosine, and its Fourier series should have only cosine
terms—<em>a</em> coefficients instead of <em>b</em> coefficients. The next plot shows this. And also note that the magnitudes
of the coefficients match between the two plots, but due to the mathematical details, the <em>a</em> coefficients
alternate between positive and negative values.</p>
<p><img src="https://s3.amazonaws.com/convolution-research-blog-assets/call-it2.png" alt="Cosine-like square wave and its harmonics"/></p>
<p>Now what happens if the shift is by some amount other than a quarter period (or some multiple)? Remember <a href="http://en.wikipedia.org/wiki/Even_and_odd_functions">odd
and even functions</a> from high-school math? An odd function follows:</p>
<p>$$ f(-x)=-f(x) $$</p>
<p>A sine function is an example. A cosine function, on the other hand, is even and follows:</p>
<p>$$ f(-x) = f(x) $$</p>
<p>So another way of looking at the two examples above is that the first square wave is an odd function and the
second (shifted by a quarter period) is even. If you add even functions together, you end up with an even function.
Likewise with adding odd functions to get an odd sum. So it makes sense that the odd square wave only has sine constituents,
and the even square wave is built from cosines.</p>
<p>If we do shift the square wave by some arbitrary amount it will no longer be an odd or even function,
and it will take some mixture of sines and cosines to build it up. If you shift the sine-phased square wave
to the left by some amount t’ and crunch the calculus, you end up with these coefficients:</p>
<p>$$a_n = \frac{2 \sin(n t’)}{n \pi} \left( 1-\cos(n\pi)\right)$$</p>
<p>$$b_n = \frac{2 \cos(n t’)}{n \pi} \left( 1-\cos(n\pi)\right)$$</p>
<p>The next plot shows the result.</p>
<p><img src="https://s3.amazonaws.com/convolution-research-blog-assets/call-it3.png" alt="Dephased square wave and its harmonics"/></p>
<p>When we superimpose the sum of just the cosine terms—the first 10 harmonics—and the sum of just the sine terms on the shifted
square wave, a pattern emerges. Note in the plot below that the cosine terms (red) fill in the portion of the
shifted square wave that is even, and the sine terms (blue) fill in the portion that is odd.</p>
<p><img src="https://s3.amazonaws.com/convolution-research-blog-assets/call-it4.png" alt="Odd and Even Portions of the Dephased Square Wave"/></p>
<p>Now you may have noticed one other detail: regardless of the shift, the coefficients for even harmonics—not
talking about even functions, rather simply even indexes (2, 4, 6, …)—are always zero. We’ll look at that
in a <a href="http://www.convolutionresearch.com/blog/posts/broken-symmetry-and-fourier-transforms">future post</a> and also look at applying this stuff to some real-world problems. Stay tuned.</p><img src="http://feeds.feedburner.com/~r/TheConvolutionResearchBlog/~4/cLaJjnhm1iQ" height="1" width="1" alt=""/>Thu, 09 May 2013 16:07:00 +0000
http://feedproxy.google.com/~r/TheConvolutionResearchBlog/~3/cLaJjnhm1iQ/call-it-even-or-odd
http://www.convolutionresearch.com/blog/posts/call-it-even-or-oddGreg Ingersollhttp://www.convolutionresearch.com/blog/posts/call-it-even-or-oddThey Call Him Mr. Gibbs<p>The math here is driven by what is by far my favorite interview question. In all the interviews that I’ve conducted as an engineer and engineering manager at various places, not one person has ever gotten it right. (So by reading this, you’re giving yourself a leg up.) It’s not a great interview question really, but I just find it interesting that this tidbit stuck with me, and no one else seems to remember it from engineering school.</p>
<p>First, a little background. A great deal of signal processing—and analysis of linear systems in general—relies on basis decomposition. This essentially means taking a signal and breaking it down into a sum of much simpler functions that are each easy to deal with. In Fourier analysis, the <em>basis</em> consists of the set of sinusoids of different frequencies. When adding together the constituent parts, you can vary the amplitude and phase (equivalently the complex amplitude) from one frequency to the next. This is what defines linear analysis/synthesis: basically you can only scale and add.</p>
<p>Further, the individual sines/cosines are called <em>orthogonal</em>—a term borrowed from vector math—because you cannot decompose a sine wave into a sum of sine waves of different frequencies:</p>
<p>$$A \sin(f_1 x) + B \sin(f_2 x) \ne sin(f_3 x)$$</p>
<p>(For unique frequencies and non-zero A and B of course.) Just like if you had three vectors perpendicular (or <em>orthogonal</em>) to each other. In 3D space, no linear combination of a vector in the x-direction and one in the y-direction can result in a vector in the z-direction.</p>
<p>If, in addition, the sine waves forming the basis are scaled appropriately relative to each other, they are said to be <em>normalized</em>. All of this makes an <a href="http://en.wikipedia.org/wiki/Orthonormal" target="_blank"><em>Orthonormal Basis</em></a>.</p>
<p class="p1">Now with that basis—pun intended—if you take a periodic signal, you can find the amplitude of each constituent sine wave making up the signal by calculating the Fourier series. <a href="http://en.wikipedia.org/wiki/Fourier_series" target="_blank">Wikipedia</a> and countless other sources provide the formulas for using sines and cosines to analyze the periodic function f(x):</p>
<p class="p1">$$ f(x) = \frac{a_0}{2} + \sum_{n=1}^{\infty}a_n \cos(nx) + b_n \sin(nx) $$</p>
<p class="p1">where:</p>
<p class="p1">$$a_n= \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \cos(nx) dx, \quad n \ge 0 $$</p>
<p class="p1">and:</p>
<p class="p1">$$b_n= \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \sin(nx) dx, \quad n \ge 1 $$</p>
<p class="p1">The coefficients a and b provide the amplitudes of sines (and cosines) with a discrete set of frequencies that are all multiples of the repetition rate of the original periodic signal. These are the <em>harmonics</em> of the original signal. (For non-periodic signals, you calculate the continuous Fourier Transform of the signal to get the amplitudes of a continuum of frequencies of sine waves. Likewise, you can use other basis functions such as the set of Laguerre-Gaussians if you’re dealing in 2D and circular symmetry.)</p>
<p class="p1">Again, the good people editing <a href="http://en.wikipedia.org/wiki/Fourier_series" target="_blank">wikipedia</a> have some lovely graphics that you should look at. I will only show a couple basic things here that get us back to the original point. Let’s look at the first three odd, sine harmonics of a square wave. (As it happens, if the square wave crosses zero at the origin and has a 50% duty cycle it only has odd, sine harmonics.) Superimposing these on the square wave, we see that the fundamental (red) has the same period as the square wave itself, and it “fills in” most of the square wave like painting a wall with a big roller. The next two odd harmonics have three (green) and five (blue) times the frequency of the fundamental, and they serve to fill in the corners of the square wave like painting with a trim brush and a detail brush.</p>
<p class="p1"><figure class="tmblr-full" data-orig-height="197" data-orig-width="400"><img alt="image" src="https://66.media.tumblr.com/e06d2b23b9f6315fad6d1fc756722432/c694658b6703fb5e-4e/s540x810/ba6492f0693d10eb790b74dad75cf9b559a9960b.png" data-orig-height="197" data-orig-width="400"/></figure></p>
<p class="p1">Also note that the amplitudes of the harmonics decrease with increasing frequency. Think of it this way: only the sharp transitions benefit from the detail provided by higher and higher frequencies, and these transitions are a relatively small part of the whole signal. And note too that the harmonics and the square wave all cross y=0 together, and the phases of the harmonics alternate in the center of a square pulse (the red and blue traces have peaks where the green trace has a valley).</p>
<p class="p1">Now instead of looking at the harmonics individually, we will build the square wave by adding harmonics together. We don’t truly get a square wave until we have added in infinitely many sine waves of increasing frequency. Until infinity—which is never reached—we end up with varying degrees of overshoot and undershoot at the transitions and ripple in the “flats”. The next figure shows the square wave (black) and the sums of the first five (blue), ten (red), and twenty (green) non-zero harmonics.</p>
<p class="p1"><figure class="tmblr-full" data-orig-height="255" data-orig-width="450"><img alt="image" src="https://66.media.tumblr.com/0914b81740c9ffa09049e5ed84224127/c694658b6703fb5e-a9/s540x810/772c258dc021518b315fd0db58b0dfa6be27b8ed.png" data-orig-height="255" data-orig-width="450"/></figure></p>
<p class="p1">Now the answer to the interview question: Interestingly, the amplitude of the over/undershoot is constant at roughly 9% of the square wave’s amplitude as you add more and more constituent frequencies. (Rigorously it is not constant, but rather it approaches this finite limit.) This is the <a href="http://en.wikipedia.org/wiki/Gibbs_phenomenon" target="_blank">Gibbs Phenomenon</a>.</p>
<p class="p1"><em>Gibbs Phenomenon</em>. Remember that.</p><img src="http://feeds.feedburner.com/~r/TheConvolutionResearchBlog/~4/Kxp7rpaNLOY" height="1" width="1" alt=""/>Sun, 28 Apr 2013 20:55:00 +0000
http://feedproxy.google.com/~r/TheConvolutionResearchBlog/~3/Kxp7rpaNLOY/they-call-him-mr-gibbs
http://www.convolutionresearch.com/blog/posts/they-call-him-mr-gibbsGreg Ingersollhttp://www.convolutionresearch.com/blog/posts/they-call-him-mr-gibbsStrong Roots<div class="post_image pull-right"><figure class="tmblr-full" data-orig-height="357" data-orig-width="500"><img src="https://66.media.tumblr.com/549a84b992e5eed7af1ba00217447b00/bf5671a3c880d645-b3/s540x810/b7e6d1114fc97162df67bcd188808d9fa4c4b0ac.jpg" data-orig-height="357" data-orig-width="500"/></figure><p class="caption">Your product is complex. You’ll have a big tree of requirements, and that’s ok. Just have a solid base. (That’s a big tree.)</p>
</div>
<p>So it’s the time of year when I spend some—ok, maybe a bit too much—time watching some interesting sports. My Wisconsin Badgers in basketball who did well in the B1G tournament but not the NCAA; the Badgers in hockey who won the WCHA tournament and are off to the NCAA; and the start of the Formula1 racing season where I’m intrigued by the personalities, and I love the technology.</p>
<p>But I question the advertising.</p>
<p>Watching the Malaysian Grand Prix this weekend, there was a common ad for a motorcycle/ATV company who were touting their “driver-centered design.” Now this may be novel because their competition ignores the driver or their own previous designs did. I’m not sure. But why would anyone designing a motorcycle not center the design on the driver? The driver is fairly important in the equation. (And before you mention aerodynamics, don’t forget that a fast bike is something the driver wants.)</p>
<p>The same is true for any user of any product, and you need to pay attention when capturing requirements and working through the initial design and engineering of your next product. Starting with the user allows you to form a logical tree of requirements that are all rooted in things that provide value to your users or address their concerns or give them enjoyment.</p>
<p>Now, user requirements are certainly top-level requirements, but they are not the only things on the top line. Certainly if users don’t want your widget, you won’t sell very many. But if governments won’t let you sell it, you won’t sell very many either. You also need to consider agency requirements and fulfillment of standards—for the FCC, FDA, USDA, UL, CSA, CE, and on and on—from the start. (I’ve seen too many people try to fill out a mountain of paperwork at the end when things are already running late and running out of money.)</p>
<p>Finally, there is your brand. In order to compete, you need to differentiate your product from the other guy, and often the products you offer will have similar features and traits. Ask your marketing experts for specific guidelines for colors, sizes, logos, icons, labels, etc. at the start of your next project. Don’t wait until they see the prototype and ask you to change, well, everything.</p>
<p>So to get off on the right foot, build your top-level requirements with three categories in mind:</p>
<ul><li>Users: if you’re not solving problems—or if you end up creating them—for your users, what’s the point?</li>
<li>Agencies: if it’s not approved, you can’t sell it.</li>
<li>Brand: your users recognize and enjoy your current products, don’t they? Keep that going.</li>
</ul><p>…and branch out from there.</p><img src="http://feeds.feedburner.com/~r/TheConvolutionResearchBlog/~4/-5ntV_az0Ec" height="1" width="1" alt=""/>Sun, 24 Mar 2013 23:19:50 +0000
http://feedproxy.google.com/~r/TheConvolutionResearchBlog/~3/-5ntV_az0Ec/strong-roots
http://www.convolutionresearch.com/blog/posts/strong-rootsGreg Ingersollhttp://www.convolutionresearch.com/blog/posts/strong-rootsRebuilt Engine<p>The marathon coding sessions are done; 35 productive hours over three days. I deleted a bunch of code and made this blog more maintainable.</p>
<p>Writing the original blog engine in Rails was a great case study, but at the end of the day, there are plenty of things out there that handle blogging and have much more mature editors than my initial crack at it.</p>
<p>In short, inspired by <a href="http://robots.thoughtbot.com/post/42849340481/our-tools-of-the-trade" target="_blank">Thoughtbot’s Tools of the Trade</a> and <a href="http://sethgodin.typepad.com/seths_blog/2010/08/foundation-elements-for-modern-businesses.html" target="_blank">Seth Godin’s bullet point about leveraging cheap off the shelf software</a>, I dropped the Rails ActiveRecord model for the blog and instead hooked into Tumblr’s API. (Tying into an external API was another good exercise for upcoming projects.)</p>
<p>The end result is that you should be getting more posts from me and more often. And this also gives me solid base from which to launch my podcast.</p>
<p>And I added tagging.</p>
<p>Stay tuned.</p><img src="http://feeds.feedburner.com/~r/TheConvolutionResearchBlog/~4/gyOfbC9-9co" height="1" width="1" alt=""/>Fri, 15 Mar 2013 16:33:09 +0000
http://feedproxy.google.com/~r/TheConvolutionResearchBlog/~3/gyOfbC9-9co/rebuilt-engine
http://www.convolutionresearch.com/blog/posts/rebuilt-engineGreg Ingersollhttp://www.convolutionresearch.com/blog/posts/rebuilt-engineDietary Intake<p>I was reviewing customer requirements on a recent project, and we came across something unintentionally comical. There was a requirement for illumination intensity which is given as power per unit area, in this case microwatts per square centimeter (uW/cm^2). The problem was that the <em>m</em> was missing leaving uW/c^2.</p>
<div class="post_image pull-right"><img src="http://s3.amazonaws.com/convolution-research-prod-assets/mercury/images/images/000/000/022/original/IMG_1659.jpg?1363032075"/><p class="caption">6 ounces of cake over 10 minutes is roughly 0.28g/s.</p>
</div>
<p>Now <em>c</em> is not a unit, but in the context of light, it represents the speed of light with units of meters per second. Just for fun, I plugged this into <a href="http://www.wolframalpha.com" target="_blank">Wolfram Alpha</a> as “500uW/c^2”. This reduced to having units of kilograms per second which the tool interpreted as “recommended dietary intake”!</p>
<p>This instance was an obvious typo, but it does highlight the need to be careful when authoring and reviewing requirements. Missing a digit, for example, could have far-reaching consequences for your project. And completely wrong units can <a href="http://en.wikipedia.org/wiki/Mars_Climate_Orbiter" target="_blank">cause your Mars probe to crash</a>. Better to catch these things early.</p>
<p>And while we‘re on the subject, what do you use for requirements management? I’m guessing Word/Excel is a popular answer. Leave a comment below. This is a topic I will be covering in future posts.</p><img src="http://feeds.feedburner.com/~r/TheConvolutionResearchBlog/~4/pmA3AbEpz0A" height="1" width="1" alt=""/>Mon, 11 Mar 2013 19:10:00 +0000
http://feedproxy.google.com/~r/TheConvolutionResearchBlog/~3/pmA3AbEpz0A/dietary-intake
http://www.convolutionresearch.com/blog/posts/dietary-intakeGreg Ingersollhttp://www.convolutionresearch.com/blog/posts/dietary-intakeUser Error<p>I’ve been keeping <a href="http://consumerist.com/2012/10/29/5-ridiculously-impossible-customer-requests-at-starbucks/" target="_blank">this link</a> around for a while because the first one on the list actually happened to me in the Detroit airport. Well, something very similar. I had a flight leaving soon, wanted coffee, but can’t drink it—especially quickly—when it’s too hot. So I asked the barista to put some ice in the cup to which she replied, “Do you want the ice at the bottom or the top?”</p>
<p>I had no idea how to respond to this except to think to myself, “If you can keep the ice at the bottom, that would be a neat trick.”</p>
<p>At any rate, it is a short, interesting article that reveals a bit about what all scientists, engineers, and product designers are up against sometimes. Remember these when you are:</p>
<ul><li>planning user research.</li>
<li>building requirements for your new product.</li>
<li>thinking about making your interfaces more/less complicated.</li>
<li>thinking about safety features to include/remove from your product.</li>
<li>thinking about supporting STEM initiatives in your local school district.</li>
</ul><p>And <a href="/requests/new">contact us</a> if you need another set of eyes on your requirements, need people to help with your STEM initiative, or if you have an idea for something you would like to learn from this blog.</p><img src="http://feeds.feedburner.com/~r/TheConvolutionResearchBlog/~4/v-J3H9UmdUA" height="1" width="1" alt=""/>Mon, 04 Mar 2013 18:48:00 +0000
http://feedproxy.google.com/~r/TheConvolutionResearchBlog/~3/v-J3H9UmdUA/user-error
http://www.convolutionresearch.com/blog/posts/user-errorGreg Ingersollhttp://www.convolutionresearch.com/blog/posts/user-errorShoreline Waves<p>In a <a href="http://www.convolutionresearch.com/blog/posts/resolving-eye-shapes">previous post</a> I mentioned that an optical plane wave—or any plane wave for that matter—when viewed in the frequency domain has a spatial frequency that depends on its arrival angle. Oftentimes, the data you see in the frequency domain is referred to as a <em>spectrum</em>, and plane waves arriving from different angles form an <em>Angular Plane Wave Spectrum</em>.</p>
<div class="post_image pull-right"><img src="http://s3.amazonaws.com/convolution-research-prod-assets/mercury/images/images/000/000/018/original/waves.png?1360720603"/><p class="caption">Waves near Jacksonville Beach, FL.</p>
</div>
<p>Looking at unit conversion, going from the time domain to its corresponding frequency domain converts from seconds to 1/seconds (or cycles per second or Hertz). Space, millimeters, goes to 1/mm (or sometimes line pairs per mm). But how do we go from an angle in radians to 1/mm?</p>
<p>First, consider a shoreline with waves coming in. The waves are comprised of a series of peaks and valleys with some spacing—the wave period—and they are traveling along a line that intersects the shoreline at some angle. If you were to freeze time and walk down the shoreline, you’ll also see peaks and valleys, and the spacing here is what defines the spatial frequency of the wave in the plane of the shoreline. (In optical terms, the “shoreline” could be any plane of interest in the system: an aperture, a lens, a sensor, etc.)</p>
<div class="post_image"><img src="http://s3.amazonaws.com/convolution-research-prod-assets/mercury/images/images/000/000/019/original/waves1.png?1360720731"/><p class="caption">A traveling wave. Note how when the wave is sliced at an angle, the cross section is also a sine wave but with a lower frequency.</p>
</div>
<p>The simplest case, of course, contradicts what I just said. If the waves are coming in directly at the shore, as you walk along, the amplitude does not have peaks and valleys. It is constant, or has zero frequency (or is DC if you are an electrical engineer). As the angle of incidence increases, peaks and valleys appear, but they are spaced very far apart from each other. That is they have a low frequency, and the frequency increases as the angle increases. (In the limit, the angle is 90 degrees, the wave is traveling parallel to the shore, and the apparent frequency is equal to the wave frequency.)</p>
<div class="post_image"><img src="http://s3.amazonaws.com/convolution-research-prod-assets/mercury/images/images/000/000/020/original/waves2.png?1360720846"/><p class="caption">Peaks and valleys of a plane wave crossing the “shore” at an angle. The double arrow denotes the period of the traveling wave. The spacing between two peaks along the shore gives the wave period—one over the frequency—in that plane.</p>
</div>
<p>Finally, a little trigonometry will give us the frequency of the wave in the angular plane wave spectrum as a function of its angle and period. Look at the same figure with a superimposed triangle. The wave (with period lambda) arrives at an angle, theta, relative to the dashed line which is perpendicular to the plane of interest (i.e. theta is relative to the <em>plane normal</em>). The spacing between peaks in the plane of interest is the hypotenuse of the triangle, and the length of this is the inverse of the spatial frequency, f, in the plane.</p>
<div class="post_image"><img src="http://s3.amazonaws.com/convolution-research-prod-assets/mercury/images/images/000/000/021/original/waves3.png?1360720850"/><p class="caption">The same figure with a superimposed triangle. (Get that trig identity table out.)</p>
</div>
<p>So f is given by:</p>
<p>$$f=\frac{\sin(\theta)}{\lambda}$$</p>
<div><br/><p>This has units of 1/length which is expected for spatial frequency, and the sine function takes care of the angle units.</p>
</div><img src="http://feeds.feedburner.com/~r/TheConvolutionResearchBlog/~4/xf-J_tp2R4c" height="1" width="1" alt=""/>Wed, 13 Feb 2013 01:05:00 +0000
http://feedproxy.google.com/~r/TheConvolutionResearchBlog/~3/xf-J_tp2R4c/shoreline-waves
http://www.convolutionresearch.com/blog/posts/shoreline-wavesGreg Ingersollhttp://www.convolutionresearch.com/blog/posts/shoreline-wavesSimple Addition<p>Ok, here’s an easy one. When does 17+17=20?</p>
<p>I was looking at basic <a href="http://www.cisco.com/en/US/docs/wireless/access_point/channels/lwapp/reference/guide/1140_chp.html" target="_blank">WiFi power limits</a> just now and one of the tables caught me off guard for a second until I looked at the units. (Always check units.) One of the tables indicates that a system can have two antennas with output power from each of 17 for a total of 20. How?</p>
<p>The catch is that the power figures are in dBm which is a logarithmic scale so addition isn’t just addition anymore. And units of dBm give the output power in decibels (dB) relative to 1 milliwatt (which is where the “m” in dBm comes from). </p>
<p>So take your output power, say 5mW. Relative to 1mW, this is 5 times larger, or about a 7dB increase:</p>
<p>$$10\cdot \log_{10}\left(\frac{5\text{mW}}{1\text{mW}}\right) \approx 7\text{dBm}$$</p>
<div><br/><p>Likewise, 1mW is 0dBm; there is no increase or decrease from the 1mW reference.</p>
<p>(Also, if you’ve seen the dB calculation with 20log instead of 10log, that is for amplitude, not power. Power is proportional to amplitude squared so you lose a factor of two after the log. But I digress…)</p>
<p>Working backwards, 17dBm is equivalent to about 50mW. Twice this is 100mW which is equivalent to 20dBm. 17+17=20.</p>
</div><img src="http://feeds.feedburner.com/~r/TheConvolutionResearchBlog/~4/mSlz19uLH2U" height="1" width="1" alt=""/>Thu, 07 Feb 2013 21:00:00 +0000
http://feedproxy.google.com/~r/TheConvolutionResearchBlog/~3/mSlz19uLH2U/simple-addition
http://www.convolutionresearch.com/blog/posts/simple-additionGreg Ingersollhttp://www.convolutionresearch.com/blog/posts/simple-additionResolving Eye Shapes<p>If you have ever looked closely at the eyes of certain animals, you may have noticed something about the shapes of their pupils. Some animals, say humans, have round pupils while other animals, cats for instance, have tall thin pupils. And animals like deer and goats have pupils that are wider than they are tall. What are the advantages of each? One way of looking at the answer involves a quick diversion into spatial frequency analysis and properties of Fourier transforms.</p>
<div class="post_image pull-left"><img src="http://s3.amazonaws.com/convolution-research-prod-assets/mercury/images/images/000/000/008/original/cateyes.jpg?1359658211"/><p class="caption">Domestic cats have tall narrow pupils.</p>
</div>
<p>Consider light coming from two distant stars—pinpricks in the sky. The wavefront of the light expands spherically from each star, and by the time it reaches your eye, the sphere is so big that it seems basically flat, or planar, instead of curved. So what we have is a plane wave from each star, and because the stars are in different places, the waves are traveling at slightly different angles. Having different angles is equivalent to having different spatial frequencies (the reason is straightforward, but is a whole post by itself).</p>
<div class="post_image pull-right"><img src="http://s3.amazonaws.com/convolution-research-prod-assets/mercury/images/images/000/000/009/original/deereyes.jpg?1359658240"/><p class="caption">The pupils of deer are wider than they are tall.</p>
</div>
<p>When these two plane waves pass through an aperture like the anatomical pupil of your eye, the wavefronts are clipped. Immediately after the aperture, instead of being infinitely wide plane waves, they now stop at the edges of the aperture. These hard edges cause the light to diffract which results in additional frequency content after the aperture. Looking at this in the (spatial) frequency domain can shed some additional light.</p>
<p>In the plane of the aperture, a plane wave arriving at some angle appears as a sine wave when plotting energy vs. location. Consulting a table of Fourier transforms, a sine wave transforms into two delta functions—infinitely thin spikes sitting at particular frequencies. One delta is at the positive frequency and one is at the negative frequency. So having two plane waves at different angles leads to four delta functions in the frequency domain.</p>
<div class="post_image"><img src="http://s3.amazonaws.com/convolution-research-prod-assets/mercury/images/images/000/000/010/original/animal_eyes1.png?1359658256"/><p class="caption">Left: two sinusoids of different frequencies (5 and 8 cycles per unit length) in the spatial domain. Right: the resulting delta functions in the spatial frequency domain.</p>
</div>
<p>The simplified aperture is just a rectangle function. This function equals 1 over the width of the aperture and equals zero everywhere else. In the frequency domain this becomes a sinc function</p>
<p>$$sinc(x)=\frac{\sin(\pi x)}{\pi x}$$</p>
<p>which is infinitely wide in frequency. And importantly, the horizontal scaling of the sinc function in frequency is inversely proportional to the width of the rectangle function: wide rect, narrow sinc lobes and vice versa.</p>
<div class="post_image"><img src="http://s3.amazonaws.com/convolution-research-prod-assets/mercury/images/images/000/000/011/original/animal_eyes2.png?1359658272"/><p class="caption">Left: the rectangular aperture. Right: Its frequency content, the sinc function.</p>
</div>
<p>Now the plane waves passing through the aperture is equivalent mathematically to multiplying the plane waves by the aperture. While addition in space is also addition in frequency, multiplication in the spatial domain leads to convolution in frequency and vice versa. (Convolution: so that’s where that name came from.) So what do we get when we convolve a sinc function with two delta functions?</p>
<p>As it happens, convolution of anything with a delta function simply gives you a copy of the something shifted to the location of the delta. So convolving the sinc with four deltas gives us four copies of the sinc in the frequency domain. Instead of two discrete frequencies (four if you count positive and negative), we now still have a fair amount of energy at those original frequencies—the sinc functions are centered there—but we also have energy splashing into infinitely many other frequencies. This is the result of diffraction from the hard aperture.</p>
<div class="post_image"><img src="http://s3.amazonaws.com/convolution-research-prod-assets/mercury/images/images/000/000/012/original/animal_eyes3.png?1359658288"/><p class="caption">The frequency domain result of the aperture clipping the two plane waves. Red and blue are the individual waves; black is the sum.</p>
</div>
<p>Now let’s move the original distant points of light closer together. The difference between the angles of the plane waves and thus the frequency separation of the delta functions decreases. But now after the convolution, the sinc functions’ main lobes have collided and blended together to where you can no longer tell there are two contributing peaks. You can no longer distinguish, or resolve, the sources as separate points. This is essentially the definition of <em>resolution</em> in an optical system. (Often the points are considered to be minimally resolved when the peak of one sinc function coincides with the first zero of the other.)</p>
<div class="post_image"><img src="http://s3.amazonaws.com/convolution-research-prod-assets/mercury/images/images/000/000/013/original/animal_eyes4.png?1359658299"/><p class="caption">Frequencies (angles) are too close together to be resolved. (Frequencies are now 5 and 6 cycles per unit length.)</p>
</div>
<p>But wait! What if the aperture gets wider? This causes the sinc functions’ lobes to get narrower meaning that the light sources can be this close together while still being distinguishable. A larger aperture provides higher resolution.</p>
<div class="post_image"><img src="http://s3.amazonaws.com/convolution-research-prod-assets/mercury/images/images/000/000/014/original/animal_eyes5.png?1359658311"/><p class="caption">The same frequencies as the previous plot, but increasing the aperture width has narrowed the sinc function, and the spots are resolvable again. (Aperture width increased from 0.5 units to 1.5 units.)</p>
</div>
<p>So back to the animals. A cat’s eye is tall and narrow. The vertical dimension of the pupil is larger giving the cat higher-resolution vision vertically than it has horizontally. This is useful for a cat climbing trees and looking for prey above and below. A goat or deer has the opposite orientation. Its pupil is wider than it is tall giving it higher-resolution vision horizontally, useful for a grazing animal watching for predators on open plains. And humans—and many other animals—have round pupils giving essential equivalent resolution vertically and horizontally. (Note that light exclusion also factors strongly into the function of animals’ eyes. For instance, cats often operate in the dark, so their retinas are quite sensitive. Their slit pupils can close down quite far during the day significantly reducing the amount of light getting in.)</p>
<p>The fundamental mathematics here—space/time vs. frequency domains, Fourier transforms, convolution—can be applied to countless problems in science and engineering. Be sure to subscribe to the blog to get new items as they come out, and leave comments and questions.</p><img src="http://feeds.feedburner.com/~r/TheConvolutionResearchBlog/~4/2mMfXBbPVgg" height="1" width="1" alt=""/>Thu, 31 Jan 2013 18:25:00 +0000
http://feedproxy.google.com/~r/TheConvolutionResearchBlog/~3/2mMfXBbPVgg/resolving-eye-shapes
http://www.convolutionresearch.com/blog/posts/resolving-eye-shapesGreg Ingersollhttp://www.convolutionresearch.com/blog/posts/resolving-eye-shapesCoins, Math, Things in the Universe<p>A few weeks ago the big news about the Higgs boson came out, and I read an <a href="http://scienceblogs.com/startswithabang/2012/07/03/the-biggest-firework-of-them-all-the-higgs/" target="_blank">interesting article</a> that talked about the experimental process. Now, I am not a particle physicist. If I’m any kind of physicist, I am a laser physicist—and yes, I know, photons are particles, but I deal more with the wave model. Anyway, more than the particles, what caught my attention right at the beginning of the article was the discussion about probabilities.</p>
<div class="post_image pull-right"><img alt="image" src="http://s3.amazonaws.com/convolution-research-prod-assets/mercury/images/images/000/000/001/original/quarter.jpeg?1357856432"/></div>
<p>A lot of the discussion about Higgs also talks about matter vs. anti-matter and why we exist at all. If a particular particle has an even chance of decaying into, say, a proton and an anti-proton (and some other stuff), and when a proton and anti-proton meet they annihilate, why do we have protons?</p>
<p>This raises the probability question that goes back to the apocryphal fair coin: if you flip a fair coin ten times, what is the chance of getting five heads and five tails (the zero-sum, total annihilation, proton-free nothingness)? As it happens, the chance is a bit less than one in four. How do we calculate this?</p>
<p>Forget about ten flips for now. Putting on my computer scientist hat, ten flips with two possible outcomes each gives a ten-bit representation with 2^10=1024 combinations. Let’s go with four flips, sixteen possible combinations. These are easily written as the four-bit binary values with a round zero as a head and, for lack of a good analogy, a one for a tail:</p>
<ul><li>0000, 4 heads</li>
<li>0001, 3 heads</li>
<li>0010, 3 heads</li>
<li>0011, 2 heads</li>
<li>0100, 3 heads</li>
<li>0101, 2 heads</li>
<li>0110, 2 heads</li>
<li>0111, 1 head</li>
<li>1000, 3 heads</li>
<li>1001, 2 heads</li>
<li>1010, 2 heads</li>
<li>1011, 1 head</li>
<li>1100, 2 heads</li>
<li>1101, 1 head</li>
<li>1110, 1 head</li>
<li>1111, 0 heads</li>
</ul>
<p>Of these 16, six have two heads and two tails. 37.5%.</p>
<p>Remember when I said to forget about ten flips? Now forget about that, but go a step further. How do we calculate the probability of total annihilation for M heads in N flips?</p>
<p>First, what is the chance of M heads followed by (N - M) tails? This is just the chance of a head multiplied by itself M times, and that multiplied by the chance of a tail (N - M) times. For a fair coin, head and tail both appear with a probability of ½, so the overall chance is (½)^N. (For the four flips in the table, only the fourth row out of sixteen rows is two heads followed by two tails.)</p>
<p>But we don’t care about the order, so how many different ways can we distribute those M heads in N flips? This is where the binomial coefficient (or sometimes the “choose” notation) comes in. You have N slots. How many ways can you choose M of them?</p>
<p>If you have two slots and want to choose one, you have two possibilities. Three slots, three possibilities. With three slots and picking two, it’s also three possibilities because it is like picking one and then taking the two that you didn’t pick. In general? N-choose-M is written as:</p>
<p class="equationImg">$$\binom {N}{M} = \frac{N!}{M!\left(N-M\right)!}$$</p>
<p>So if you take the probability of getting two heads followed by two tails, 1/16, and multiply that by all the different ways you can pick two slots to put the heads in, 4-choose-2 = 6, you get 6/16=37.5% which is what we simply counted earlier.</p>
<p>Ten flips?</p>
<p class="equationImg">$$\left(\frac{1}{2}\right)^{10} \cdot \left( \frac{10!}{5! \cdot 5!} \right) = 24.6\%$$</p>
<p>Ten billion flips? A hundred billion? 1E1000? Exercise left for the reader.</p>
<p>So based on this math, the chance of getting an even number of protons and anti-protons becomes vanishingly small over eons of decay events. When you factor in that the probabilities of the results are actually unequal—the coin isn’t even fair—the overall imbalance becomes larger still. When you factor in that the universe is expanding, and the chance of x/anti-x annihilation decreases due to just having a lot more space, even more imbalance.</p>
<p>And this is—at least a part of—why there is something.</p><img src="http://feeds.feedburner.com/~r/TheConvolutionResearchBlog/~4/Ld9wNpRrLBY" height="1" width="1" alt=""/>Thu, 02 Aug 2012 17:52:00 +0000
http://feedproxy.google.com/~r/TheConvolutionResearchBlog/~3/Ld9wNpRrLBY/coins-math-things-in-the-universe
http://www.convolutionresearch.com/blog/posts/coins-math-things-in-the-universeGreg Ingersollhttp://www.convolutionresearch.com/blog/posts/coins-math-things-in-the-universeMD5<p>I thought we were pretty much past corrupted downloads at this point in the century, but apparently not.</p>
<p>I’ve been doing some software work recently, and I needed to download a demo compiler. The download completed, and I started the install, but it never finished. It turns out that the install crashed because it had managed to fill up the 20GB of free space in my Windows virtual machine. And that happened because the installer file was incomplete and it went off into the weeds.</p>
<p>Three download attempts and two hours later using a total of two OSs and three different browsers, I finally got the complete file. (Especially disappointing given that the full version of this compiler is rather expensive.)</p>
<p>So Pro Tip: always at least check file sizes. Also on OSX you can calculate the MD5 checksum of a file from the terminal using:</p>
<pre class="prettyprint">$ md5 myfile
</pre>
<p>On Windows, there are several free utilities a Google search away.</p><img src="http://feeds.feedburner.com/~r/TheConvolutionResearchBlog/~4/HSz81BUfmVc" height="1" width="1" alt=""/>Mon, 23 Jul 2012 21:07:00 +0000
http://feedproxy.google.com/~r/TheConvolutionResearchBlog/~3/HSz81BUfmVc/md5
http://www.convolutionresearch.com/blog/posts/md5Greg Ingersollhttp://www.convolutionresearch.com/blog/posts/md5En?t[oy]mology<p>Driving home today, I was listening to a podcast discussing beekeeping and the strange disappearance of bees. They mentioned the Latin names of some desirable (to bees) flowers and also of the bees themselves.</p>
<p>I had to wonder if anyone out there studies the origins of names of insects. Would that person be an entomologist, etymologist, or both?</p>
<p>(Oh, the title: if you need a good online resource for learning about or testing regular expressions, check out <a href="http://rubular.com">http://rubular.com</a>.)</p><img src="http://feeds.feedburner.com/~r/TheConvolutionResearchBlog/~4/QP3bq9rg5gU" height="1" width="1" alt=""/>Tue, 17 Jul 2012 01:45:00 +0000
http://feedproxy.google.com/~r/TheConvolutionResearchBlog/~3/QP3bq9rg5gU/entoymology
http://www.convolutionresearch.com/blog/posts/entoymologyGreg Ingersollhttp://www.convolutionresearch.com/blog/posts/entoymologyUp and Running<p>Well, after about a month of on-and-off effort, this website is up in its initial form. When I left my previous job at the end of May, I had a business in the back of my head, but my primary reason for departure was to spend time focusing on my Ph.D. dissertation.</p>
<p>Unfortunately, I almost immediately hit a roadblock with some needed holographic materials being on a 5+ week lead-time. So, with less to do in the lab in June than I anticipated, I set off down the road of launching this business and designing this website.</p>
<p>There is more to do on the site—a lot of it is behind the scenes for my benefit—and I have enjoyed learning Rails and doing some graphic design work. But that is not the core of the business obviously.</p>
<p>Convolution Research exists to develop technologies and applications of those technologies to improve the world for all of us. We (I) do this by applying skills in pure science, research, electrical and software engineering, and product design to your impossible problems and my own (I have a few ideas brewing).</p>
<p>I hope you like the site. As things move forward, I will be posting about science, engineering, and project and requirements management, along with posting news and interesting articles.</p>
<p>Be sure to check in from time to time; follow us (and me) on Twitter; subscribe to the blog; and contact us (me for now) when you hit your next impossible problem.</p><img src="http://feeds.feedburner.com/~r/TheConvolutionResearchBlog/~4/Hxv8HXUQvmE" height="1" width="1" alt=""/>Sat, 07 Jul 2012 17:05:00 +0000
http://feedproxy.google.com/~r/TheConvolutionResearchBlog/~3/Hxv8HXUQvmE/up-and-running
http://www.convolutionresearch.com/blog/posts/up-and-runningGreg Ingersollhttp://www.convolutionresearch.com/blog/posts/up-and-running