# Matlab Example Programs and Utilities

Sort by: Name | Most recentascii_art.m

base_conversion.m

Convert a number from one base to another

Supports decimals, bases up to 36, only positive numbers

better_menu_example.mSupports decimals, bases up to 36, only positive numbers

Better menu example

A simple alternative to MATLAB's menu command - centered and optional sizing

bounce.mA simple alternative to MATLAB's menu command - centered and optional sizing

cell_extract.m

Compute the center of mass of an image

by treating each pixel as a point mass

center_menu.mby treating each pixel as a point mass

Purpose: Create a centered MATLAB menu

Method: Create a timer that moves the menu after it is displayed

because MATLAB doesn't provide a way of positioning the menu.

This is kludgy, but it seems to work.

coulomb.mMethod: Create a timer that moves the menu after it is displayed

because MATLAB doesn't provide a way of positioning the menu.

This is kludgy, but it seems to work.

create_animation.m

curvature.m

Demonstrate symbolic math in MATLAB

Calculate the radius of curvature for trajectory equation

Calculate normal and tangential acceleration components

dictionary_read.mCalculate the radius of curvature for trajectory equation

Calculate normal and tangential acceleration components

Example of reading a ~500,000 word dictionary into Matlab

This example loads all words into a cell array and keeps a track of

the count of the lengths and displays all words over 20 characters long

digitize.mThis example loads all words into a cell array and keeps a track of

the count of the lengths and displays all words over 20 characters long

ef_shooter_gui.m

Engage golf ball gun analysis/simulator

A GUI for setting parameters and displaying results of a 'shooter'

file_text_table.mA GUI for setting parameters and displaying results of a 'shooter'

gpa2.m

GPA calculator example

reads and writes text data files

image_cropper.mreads and writes text data files

Interactive image cropping

Prompts user for a file name of a file that contains one or more

images that are to be rotated and cropped. The user then clicks on the

corners of the images and Matlab extracts, rotates, crops, and

saves the sub-image(s).

image_edge_detect.mPrompts user for a file name of a file that contains one or more

images that are to be rotated and cropped. The user then clicks on the

corners of the images and Matlab extracts, rotates, crops, and

saves the sub-image(s).

image_marker_example.m

Image transparency example

Shows how to use and make a transparency matrix with an image

imagemenu.mShows how to use and make a transparency matrix with an image

Image menu example

Shows a set of images and allows the user to select one

kick3d.mShows a set of images and allows the user to select one

Demo of how to show a 3D trajectory on an image

mario2.mmenuplus.m

Example of reading a movie (AVI) file

Displays a montage of individual frames in a figure window

and creates a file with a montage of frames and displays the file

optimization_trough.mDisplays a montage of individual frames in a figure window

and creates a file with a montage of frames and displays the file

pendulum_wave_gui.m .fig file

Fifteen Pendulums Swinging

Simulation with GUI showing fifteen pendulums swinging together

The lengths are such that they make neat visual patterns near 0, 30, and 60 seconds

This .m file requires the similarly named .fig file

physics_block_on_incline.mSimulation with GUI showing fifteen pendulums swinging together

The lengths are such that they make neat visual patterns near 0, 30, and 60 seconds

This .m file requires the similarly named .fig file

A general solution for a box on incline with force and friction

Has routines for drawing straight and curved vectors

plot_date_scale.mHas routines for drawing straight and curved vectors

plotcurves.m

plotting_background_image.m

Function to format a polynomial coefficient list as an equation text

polystring2.m Projectile motion with a target and drag - example from EF 102 2003

quakeplot.m Example of importing data and plotting

rockytop2.m Example of playing a song

Parses a text string of 'notes' and plays the song by generating the appropriate

frequency curves. Minimal documentation.

rotate_image.mParses a text string of 'notes' and plays the song by generating the appropriate

frequency curves. Minimal documentation.

Approximate integral using composite simpson rule

http://en.wikipedia.org/wiki/Simpson's_rule

simulation_hibbler_12_19.mhttp://en.wikipedia.org/wiki/Simpson's_rule

socks.m

Demonstrate playing a music file with a fade in and out

space_invaders.m Simple space invaders game

Example of simple real-time user interaction

Ugly code with minimal comments

sudoku_solver2.mExample of simple real-time user interaction

Ugly code with minimal comments

Example of using a switch statement with a menu

temperature_from_web.m Example of working with text

Displays the complete lyrics to '99 bottles of beer...'

text_placement_example.mDisplays the complete lyrics to '99 bottles of beer...'

Example of centering text in a figure

timer_demo.m Example of using a timer to simulate a clock ticking

trajectory.m Solve projectile motion trajectory equation for any variable

truss_wrs.m A large truss analysis program with many different examples

Creates plots of geometry, results, FBDs, and equations

vector_drawing.mCreates plots of geometry, results, FBDs, and equations

webpage_create.m

Example of how to create a web page with Matlab output

Has functions for putting tables, text, titles, and images on the page

Has functions for putting tables, text, titles, and images on the page