Introducing our Forums

We just launched our new Forums page on Matlab Geeks.  Because of the large quantity of questions that we receive through email and on our posts, we thought that it would be more productive for you (and easier for us) if these questions saw more public exposure.  If you have a question about Matlab, please post it on our forums.  Additionally, if you know the answer to a question that someone has posted, please answer it.  We hope to build a community of Matlab users on this site which will be mutually beneficial for all of those involved.  To participate in the forums, just click this link or the “Forums” link under the header.

How to Blur an Image with a Fourier Transform in Matlab – Part I [Revised*]

In the last post, many moons ago, I introduced the 2-D FFT and discussed the magnitude and phase components of the spatial Fourier domain.  In the next few posts, I would like to describe a concrete application of the 2-D FFT, namely blurring.  Blurring and deblurring are useful image processing techniques that can be used in a variety of fields.  I will explain what blur is mathematically and how it is performed artificially.  In future posts, I’ll go into more depth about what happens in the spatial domain, different types of blur, and some current deblurring technology.

Continue reading

Managing Your Path in Matlab – Part II

In the last article I wrote about managing your path in Matlab, I covered some of the functions that deal with the search path, including path, matlabroot, addpath, rmpath and genpath.  These functions provide a solid base for viewing, adding and removing directories from your search path.  In this article, I will explain how to use several more functions that deal with your search path, including functions that make changes which persist after ending your Matlab session. Continue reading

Managing Your Search Path in Matlab – Part I

Management of your search path in Matlab is an important skill that every Matlab programmer should have.  Your search path is the ordered set of directories that Matlab uses to find a function that you call.  Being aware of your search path is a good habit, especially if you are working with multiple versions of the same code.  In this post and the following post, I will describe how to use Matlab to modify your search path. Continue reading

How to Do a 2-D Fourier Transform in Matlab

In today’s post, I will show you how to perform a two-dimensional Fast Fourier Transform in Matlab.  The 2D Fourier Transform is an indispensable tool in many fields, including image processing, radar, optics and machine vision.  In image processing, the 2D Fourier Transform allows one to see the frequency spectrum of the data in both dimensions and lets one visualize filtering operations more easily.  In radar, the 2D Fourier Transform is used as a fast way to create a map from a series of coherent radar pulses.  Additionally, the far-field pattern of a 2D antenna can be calculated using a 2D Fourier Transform.  In Fourier Optics, the 2D Fourier Transform is used to calculate the propagation of electromagnetic waves and through space and optical elements. Continue reading

Vectorization in Matlab Not Always Necessary

What separates Matlab from many other programming languages is the ability to vectorize code.  Vectorization allows a programmer to write code that is more intuitive, more concise, and often faster than using standard for, while and if statements.  If you have to do a large data processing task or need to create real-time application that does a large number of mathematical operations, vectorization is often a good option.  However, vectorization is not always the faster alternative for time-sensitive tasks.   I created tests for six tasks and compared the amount of time needed to run the vectorized and non-vectorized code.  The results were mixed, showing a decrease in running time for vectorized code on some tasks and a increase in running time on other tasks.  Tests involving mathematical operations ran faster using vectorized code, while tests involving conditional operators and vector creation ran faster for non-vectorized code.

[table id=13 /] Continue reading

Energy Release in Recent Earthquakes

After researching earthquakes a few weeks ago, I found a great deal of interesting information regarding energy release, frequency, and a multitude of other topics.  Today I will write about the release of energy from earthquakes since the beginning of the 20th century and compare the earthquakes of the last decade to those of the past century.

Continue reading

How to Use Imagesc in Matlab

On Matlab Geeks, we have already covered basic two-dimensional plotting techniques.  We would now like to start covering techniques for plotting three-dimensional data.  One of the easiest and most visually pleasing ways of plotting three-dimensional data onto a 2-D surface is imagesc.  Originally meant to be used with image data, this function is a great tool for plotting 2-D matrices.  Imagesc is different from the image function in that the data is automatically scaled to fit the range of the colormap.  This feature makes representing a matrix with imagesc is far easier than with image.  We recommend using imagesc to plot data from a 2-D matrix. Continue reading