MATLAB Phasor Animator GUI

Last Updated: 1/17/22

As part of OPT212: MATLAB for Optics Majors II, we were tasked with creating a final project. The options were to either choose from a preset list of projects chosen by our professor or propose our own topic. I, along with my partners Nicholas Gaitanis '24 and Dwight Fairchild '23, elected to propose our own topic. One thing that I have enjoyed about learning and using MATLAB is that it is a great way of creating learning tools. It is not the most powerful program, but it is certainly intuitive and is still highly capable of creating powerful simulation and analysis tools. At the Institute of Optics, most of our classes involve using MATLAB to some capacity in order to help visualize class content.

In Physical Optics, one of the first things that we learned was how to interfere waves. One of the representations that we found particularly interesting were phasors. They are an elegant and simple way to represent wave interference along with many other phenomena both inside and outside of the optical world.

Our Goal: Create a MATLAB GUI Interface that allows users to input parameters that define component waves, interfere them, and then animate both a phasor and waveform plot with respect to time. If all goes well, send it to professors around the Institute of Optics and post it online so that people may use it as a learning tool.

Our Product:

Figure 1. GUI Interface upon launch.

Figure 2. GUI Interface after playing the animation. Note that that plot quality is low because I am on the "Low" resolution setting as that is what my laptop runs best on.

The GUI came out very nicely. The code is quite efficient and the user interface has all the relevant features we wanted and some extra in order to make this a good tool for classes throughout the Institute. During the project creation window, we were only able to add functionality in order to sum waves using this interface and in the basic situation of waves of the form y(t) = Acos(wt + phi). However, as we continue to develop the program, I can see it being useful for many things like simulating wave interference in interferometry (the Mach-Zehnder to be precise), Fourier summation and pulse creation. Even outside of the optical world it could be used to simulate oscillation-based content in general physics classes or phasor analysis (impedance) in electrical engineering. Ideally, each of these scenarios would have their own window in the GUI with extra inputs that are relative to that specific scenario.

I intend to continue develop this GUI as an independent study in order to make it a more effective and accessible tool. Prospectively, I would like to do this independent study using the time to learn Python and possibly HTML in order to transfer this program from MATLAB to Python and possibly publish it to the internet. After developing these skills, I should be able to continue creating these simulations/tools and publishing them with the goal of making learning enjoyable and visual.

If you would like to see a copy of the report associated with this project, it can be found here:

Phasor Animator, Final Report

Version Log:

MATLAB V1.0 (12/8/21):

  • Base functionality. Summation and animation of any number of waves entered by the user

  • The GUI is exported as a group of files. All of the .m files are necessary for proper function


MATLAB V1.1 (1/17/21):

  • Combined all scripts into one master script for ease of distribution

  • Minor changes to table function

  • Bug fixes concerning plot/table modifiers

  • Added help file directly to the script rather than having it be a separate file. Minor Changes to the help file