Software (mostly Matlab) by AMcClung

This is a partial listing of some of the more useful bits of Matlab code that I have accumulated. Many of them are specialized for a certain problem, but contain some useful parts that may be harvested for future scripts.

Format

Name NAME
Highlights - HIGHLIGHT
Project(s) used PROJECT(S) USED
Location LOCATION
Ex. use Example of use

ALERT! NOTE: Usable code is attached below unless corresponding data/files are too consumptive
Last checked on Matlab R14


Useful Matlab notes

  • Use arrays to plot over several areas (columns or rows) with subplot command
    • eg. subplot(2,2,1), subplot(2,2,3), subplot(2,2,[2 4])

Name avg4pts.m
Highlights - Find the average center and radius for 4pts, using the 4 circles that can be formed using 3 pts
- uses circ3ptsc.m
Project(s) used Turning curvature tests / Image processing
Location chewie\amcclung\Code\Matlab\LSCircFit
Ex. use >> avgr4pts([0 0; 0 1; 1 0; 1 1],1)

Name aviread<x>.m
Highlights - script to read avi files frame by frame and perform some blob analysis
Project(s) used SysID tests
Location chewie\amcclung\Data\Sprawl323Tests\CodeSummary
Ex. use >> d=aviRead3('cp41_1.avi');

Name beta<x>.m
Highlights - set of scripts that implement basic moment based turning model
Project(s) used Moment analysis for turning
Location chewie\amcclung\Code\Matlab\moment
Ex. use >> beta4

Name box3d.m
Highlights - used to plot 3D boxes (solid or wireframe)
Project(s) used RiSE trajectory analysis
Location chewie\amcclung\Code\Matlab\Trajectory
Ex. use >> figure, hold on, box3d(-50,50,-80,80,0,40)

Name butdz.m
Highlights - apply a butterworth filter to loaded data
-plots original and filtered data
Project(s) used SysID tests
Location chewie\amcclung\Data\TempSysIDSummary
Ex. use >> butdz(data(:,1))

Name centroids<x>.m
Highlights - locates specified numbers of centroids in B/W images (based on blob labelling)
- calculates the center of the centroids
- used in aviread.m
Project(s) used Overhead Sprawlette testing with image/video capture
Location chewie\amcclung\Data\Image\oh\oh_01
Ex. use >> C = centroids3a(bwimage,numblobs)

Name chirptern3.m
Highlights - generates a swept sine wave
- shows what signals will be sent to a servo (based on its timing cycle)
- creates a text file that can be used by Tern board to control Sprawlettes leg servos
Project(s) used SysID of SPrawlettes maneuverability
Location chewie\amcclung\Recent
Ex. use >> chirptern3(.1,10,28,4)

Name circ<x>pts.m
Highlights - calculate a circle based on <x> pts
- derived from the intersection of perdendicular bisectors of 2 chords of the circle
Project(s) used Turning curvature tests / Image processing
Location chewie\amcclung\Code\Matlab\LSCircFit
Ex. use >> [x,y,r]=circ3ptsc([0 1; 1 0; 1 1])

Name circle.m
Highlights - draws a circle given the location, radius and color
Project(s) used Simulation plots, LA plots
Location chewie\amcclung\Data\Adams\cmp\dataset9b
Ex. use >> circle(1,1,50,'g')

Name ColorCodes.m
Highlights - generates a screen full of color samples and code vectors
-change the 'depth' variable to get more colors
Project(s) used Plotting aid
Location chewie\users\Climbing\TestTrackData\ClawAdjustment_Aug17_2004
Ex. use >> ColorCodes

Name crunchaccel.m
Highlights - performs analysis on the accelerometer data from the logger to detect slip/touchdown/detachment/etc
- uses shading to differentiate strokes
- uses psd to look at frequency content
Project(s) used Video sync trials
Location chewie\amcclung\Data\TestTrack\VideoSyncTrial
Ex. use >> crunchaccel

Name crunchdat.m
Highlights - batch program to load and plot force plate data
- uses automated versions of FTplot_<x>.m for plotting
-some version include user input for friction calculation
Project(s) used Friction tests
Location chewie\amcclung\Code\Matlab\TestTrackSoftware
Ex. use Load the data 1st
>> crunchdat

Name crunchtag<x>.m
Highlights - analyze Taguchi L4 & L9 data for primary and secondary interactions
Project(s) used Design of Experiments
Location chewie\Data\Adams\cmp\dataset8e_comparison
- in data folders
Ex. use Load the data 1st
>> crunchtag4all

Name FTplot_<x>.m
Highlights - plot the data from the force plate in formatted graph
- some versions include calculations for friction
Project(s) used Various tests on the climbing wall (prototype leg, single leg, full platform)
Location chewie\amcclung\Code\Matlab\TestTrackSoftware
- in data folder
Ex. use Load the data 1st
>> FTplot_r01(trial_003,1000,60,4);

Name fullscreen.m
Highlights - makes a figure full screen, useful for user mouse input on graphs
Project(s) used Friction calculations for prototype feet for RiSE leg
Location chewie\amcclung\Code\Matlab\TestTrackSoftware
Ex. use >> plot([1,2],[2,1]), fullscreen

Name gaitgestures.m
Highlights - allows real time adjustment of data by dragging data in a plot
- stopped development because of JKarpick's GestureTweak software
Project(s) used StickyBot gait development
Location chewie\amcclung\Code\Matlab\GaitGestures
Ex. use Load the data 1st
load fourstrokegait, gaitgestures(fourstrokegait(:,[1+[9,11,1]]));

Name gbode_auto<x>.m
Highlights - automated to use input/output data to create Bode plot from FFT & SysID techniques
Project(s) used SysID tests
Location chewie\amcclung\Data\ServoTests\CodeSummary
Ex. use Load the data 1st
>> gbode_auto3('d4107',d4107,'d007',d007,1,60);

Name getMouse.m
Highlights - script to read in mouse movement from a MacroWhiz (*.mb) file and display data
Project(s) used ???TBD - Possibly to determine screen pixel locations for plotting?
Location chewie\amcclung\Code\Matlab\TestTrackSoftware
Ex. use >> getMouse;

Name GPlan.m (see GaitPlanner for latest StickyBot version)
Highlights - temporal gait planner
- allows inputs similar to CustomGaitX (pif, pir, pc)
- gives visual display of leg period phases and robot actuation
- animated, with active speed control slider
Project(s) used Gait planning for RiSE leg trajectories
Location chewie\amcclung\Code\Matlab\GaitPlanner
Ex. use >> GPlan

Name histplotcolor<x>.m
Highlights - generates a multicolored histogram from climbing data
Project(s) used RiSE foot climbing analysis
Location chewie\users\Climbing\TestTrackData\ClawAdjustment_Aug17_2004
Ex. use Load and sort the data 1st
>> load ForceData2
>> sortdata
>> histplotcolor2

Name LA<x>.m
Highlights - set of scripts to plot leg angles and intersection points for planning turning tests
- some version give leg angles, intersection points
Project(s) used Turning experiments (ADAMS & Sprawlettes)
Location chewie\amcclung\Code\Matlab\LegAngle
Ex. use >> LA22

Name ld.m
Highlights - simple script to quickly load numbered data files (starting from data001.m)
Project(s) used SysID tests
Location chewie\amcclung\Data\ServoTests
Ex. use >> ld

Name loaddata.m
Highlights - batch data sorting script to select 1 trial from a test group for analysis with other groups
- some versions create force summaries
Project(s) used Friction tests
Location chewie\amcclung\Code\Matlab\TestTrackSoftware
Ex. use >> loaddata4b('trial',1,1,5,1,1000,60,5);

Name loadlogdata.m
Highlights - loads/sorts the parameters stored in the log data file from the RiSE platform
- based on getstructdata.m
Project(s) used Reading log data structure for easier data use
Location chewie\amcclung\Data\TestTrack\VideoSyncTrial
Ex. use >> loadlogdata

Name MINNEW.M
Highlights - finds the minimum values of multidimensional arrays
Project(s) used SysID tests / ASME paper
Location chewie\amcclung\Data\TempSysIDSummary
Ex. use Load the data 1st
>> minnew2(SSRspace,5)

Name MYaviread.m
Highlights - altered script from R14 that includes progress feedback while loading video
Project(s) used Video sync trials
Location chewie\amcclung\Data\TestTrack\VideoSyncTrial
Ex. use >> a=MYaviread('TestClimb1a.avi',[1:153]);

Name Pant_Path.m
Highlights - GUI to select a path for leg trajectories with mouse clicks
Project(s) used RiSE gait generation
Location chewie\users\Software\PrototypeLegTestCode
Ex. use >> Pant_Path

Name paramidcp41<x>.m
Highlights - This script can be used to create ARX, ARMAX and BJ models for the pre-loaded data listed in the code
- System Identification Toolbox required in Matlab
Project(s) used SysID tests
Location chewie\amcclung\Data\TempSysIDSummary
Ex. use Load the data 1st
>> paramidcp41d

Name pidsearch<x>.m
Highlights - brute force model sweep for Parameter ID that calculates Sum Squared Residual (SSR) for each model
- System Identification Toolbox required in Matlab
Project(s) used SysID tests / ASME paper
Location chewie\amcclung\Data\TempSysIDSummary
Ex. use Load the data 1st
>> pidsearch

Name prbs.m
Highlights - This function produces a Pseudo Random Binary Sequence of the specified order
Project(s) used TBD
Location chewie\amcclung\Data\Sprawl323Tests\CodeSummary
Ex. use >> prbs(5)

Name procavi<x>.m
Highlights - load an 'avi' file and process the movie to determine the angle of the Sprawlette body
-added detection and recording of digital data squares
Project(s) used SysID tests
Location chewie\amcclung\Data\Sprawl323Tests\CodeSummary
Ex. use >> [beta, bdata]=procavi4('cp41_1.avi');

Name rebot.m
Highlights - automated script to read in strange data format from ADAMS simulation
- reads in data in blocks (based on S. Bailey script read_acrobot1.m)
Project(s) used ADAMS Simulation experiments
Location chewie\amcclung\Data\Adams\cmp\dataset8g_comparison
- in data folders
Ex. use >> rebot

Name rise_trajectory.m
Highlights - allows quick gait generation by adding/deleting nodes from a table
- active row coloring based on checkbox/activation state
Project(s) used Gait generation for the RiSE legs
Location chewie\amcclung\Code\Matlab\TestTrackSoftware
Ex. use >> rise_trajectory

Name scrap<x>.m
Highlights - bode diagram with plot options for dataset <x>
Project(s) used SysID tests
Location chewie\amcclung\Data\Sprawl323Tests\CodeSummary
chewie\amcclung\Data\TempSysIDSummary
Ex. use Load the data 1st
>> scrap

Name SelectLeg.m
Highlights - GUI to select/toggle legs for use by another script
- returns the buttons that are selected in the GUI
- closes the GUI and returns certain variables
Project(s) used Force plate analysis for full platform data
Location chewie\amcclung\Code\Matlab\TestTrackSoftware
Ex. use >> a=SelectLeg

Name tm<x>.m
auto_tm<x>_L.m
Highlights - read image file, convert to B&W, locate the blobs (2 hopefully)
- connect blobs by a line and determine the angle of the chord between the 2 lines
- the B&W contrast cutoff level can be set by a variable
- automated version expects a specified number of data files present
Project(s) used Overhead Sprawlette testing with image/video capture
Location chewie\amcclung\Data\Image\oh\oh_01
Ex. use >> tm3
>> [files, angs]=auto_tm3;

Name vidsync_r<x>.m
Highlights - script to syncronize video and data files (RiSE logger or force plate)
- movie is built using arrays and reassigning data within a structure
Project(s) used Video sync trials
Location chewie\amcclung\Data\TestTrack\VideoSyncTrial
Ex. use >> vidsync_gui

Name vidsync_vidgui.m
Highlights - GUI to help sync frames from video and data
- GUI allows frame by video/data viewing
- some versions allow for overlay of add'l data (crank/wing data)
- returns the frames that should be sync'd together
Project(s) used Video sync trials
Location chewie\amcclung\Data\TestTrack\VideoSyncTrial
Ex. use >> [movframe1 dataframe1]=vidsync_vidgui(mov2sync,data2sync,datasamp);

Name  
Highlights -
Project(s) used  
Location  
Ex. use  

Name  
Highlights -
Project(s) used  
Location  
Ex. use  

 
This site is powered by the TWiki collaboration platformCopyright &© by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback