Introduction to MATLAB
Overview
This session will cover the basics of programming in a high level
language such as MATLAB. We do not assume that you have any
programming experience. The session includes a brief introduction to
the MATLAB environment, and will familiarize the participant with
basic commands that are useful for analyzing data and developing
simple models. Most of the time you will work at your own pace, with
individual help from the faculty as needed.
Units
- MATLAB basics: Read and
work through the
MATLAB Primer.
- If you type commands from the Primer into the MATLAB window, you do not need to type the percent sign "%" nor
the text to the right of the percent sign on each line. These are comments for the reader, not for MATLAB.
- You can also copy-and-paste commands from the PDF copy of the Primer into the MATLAB window.
Work through the parts of the Primer that are new to you, try some of the exercises at the end of the Primer,
and please ask questions when you have them! For the last exercise, here
is a sample image.
- Advanced (Particle Tracking):
Acquiring and analyzing data from
digital video. You can download
the video here. Start with the
brief instructions for importing
video, which shows you how to read in and isolate some frames of
a video of a double pendulum with some colored stickers attached.
Then work on the following tasks.
- Write MATLAB code that identifies the pixels corresponding to (at least) the red and blue stickers in a given frame.
- Write a MATLAB function that, given the pixels you have identified, estimates the location of the center
of each sticker.
- Write a MATLAB script that estimates a state vector (angles and velocities) for each of a sequence of frames.
- Graph the estimated trajectories in various ways; animate and compare with the motion of a model for the double
pendulum.
For the model, read the description of double pendulum model (based on a more detailed
model
by Carl Akerlof) and use the associated M-files
pendrhs.m and pendanim.m.
MATLAB Resources
MATLAB computing examples
- Plotting and visualizing data.
- Matrix operations, eigenvalues, linear systems of equations
- linalg.m A variety of linear algebra and matrix/vector manipulations
- Numerical integration
- integration.m An example of numerical integration by the trapezoidal rule.
- Ordinary differential equations (ODEs)
- Boundary value problems
- Notes on PB equations An example of solving the Poisson-Boltzmann equations
for the distribution of ions near a wall with an applied
voltage. Brief notes to state the equations.
- pb.m A MATLAB example of solving the Poisson-Boltzmann equations.
July 2016 -- developed by Brian Storey with additional material by Brian Hunt, Mark Shattuck, and Shelby Wilson
[an error occurred while processing this directive]