matlab mandible tracing & calculations program
DESCRIPTION
MATLAB Mandible Tracing & Calculations Program. Documentation by Antonis Vakis Supplemental Material for: PHYLOGENY, SCALING, AND THE GENERATION OF EXTREME FORCES IN TRAP-JAW ANTS JOSEPH C. SPAGNA, ANTONIS I. VAKIS, CHRIS A. SCHMIDT, SHEILA N. PATEK, XUDONG ZHANG, and ANDREW V. SUAREZ. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/1.jpg)
MATLAB Mandible Tracing & Calculations Program
Documentation by Antonis VakisSupplemental Material for:
PHYLOGENY, SCALING, AND THE GENERATION OF EXTREME FORCES IN TRAP-JAW ANTS
JOSEPH C. SPAGNA, ANTONIS I. VAKIS, CHRIS A. SCHMIDT, SHEILA N. PATEK,
XUDONG ZHANG, and ANDREW V. SUAREZ
![Page 2: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/2.jpg)
So far, all captures have been saved as sequential
TIFF files
The images, within their original folders (e.g.
093004as4), need to be placed in a directory called
'Images,' located in the current working directory
First, run the tracing program
![Page 3: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/3.jpg)
The folder name is saved as a parameter called: filename
![Page 4: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/4.jpg)
Specify the number of frames per second (fps)
![Page 5: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/5.jpg)
Specify the width of video in pixels (width)
![Page 6: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/6.jpg)
Specify the height of video in pixels (height)
![Page 7: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/7.jpg)
Specify the image resolution in dots per inch (dpi)
![Page 8: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/8.jpg)
Viewing the image thumbnails, select the range of images over which the full motion of the mandibles is
captured
![Page 9: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/9.jpg)
Viewing the image thumbnails, select the range of images over which the full motion of the mandibles is
captured
![Page 10: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/10.jpg)
Viewing the image thumbnails, select the range of images over which the full motion of the mandibles is
captured
![Page 11: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/11.jpg)
Specify whether the strike involves both or just one of
the mandibles
![Page 12: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/12.jpg)
First, select the approximate location of the mandible base
![Page 13: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/13.jpg)
Then, sequentially select the left and right mandible tips over the selected frames of
interest
![Page 14: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/14.jpg)
Then, sequentially select the left and right mandible tips over the selected frames of
interest
![Page 15: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/15.jpg)
Then, sequentially select the left and right mandible tips over the selected frames of
interest
![Page 16: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/16.jpg)
Then, sequentially select the left and right mandible tips over the selected frames of
interest
![Page 17: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/17.jpg)
Then, sequentially select the left and right mandible tips over the selected frames of
interest
![Page 18: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/18.jpg)
Then, sequentially select the left and right mandible tips over the selected frames of
interest
![Page 19: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/19.jpg)
Then, sequentially select the left and right mandible tips over the selected frames of
interest
![Page 20: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/20.jpg)
Then, sequentially select the left and right mandible tips over the selected frames of
interest
![Page 21: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/21.jpg)
Then, sequentially select the left and right mandible tips over the selected frames of
interest
![Page 22: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/22.jpg)
Then, sequentially select the left and right mandible tips over the selected frames of
interest
![Page 23: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/23.jpg)
Then, sequentially select the left and right mandible tips over the selected frames of
interest
![Page 24: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/24.jpg)
Then, sequentially select the left and right mandible tips over the selected frames of
interest
![Page 25: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/25.jpg)
Then, sequentially select the left and right mandible tips over the selected frames of
interest
![Page 26: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/26.jpg)
Then, sequentially select the left and right mandible tips over the selected frames of
interest
![Page 27: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/27.jpg)
Then, sequentially select the left and right mandible tips over the selected frames of
interest
![Page 28: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/28.jpg)
Then, sequentially select the left and right mandible tips over the selected frames of
interest
![Page 29: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/29.jpg)
Then, sequentially select the left and right mandible tips over the selected frames of
interest
![Page 30: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/30.jpg)
Then, sequentially select the left and right mandible tips over the selected frames of
interest
![Page 31: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/31.jpg)
Then, sequentially select the left and right mandible tips over the selected frames of
interest
![Page 32: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/32.jpg)
Then, sequentially select the left and right mandible tips over the selected frames of
interest
![Page 33: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/33.jpg)
Finally, reselect the approximate location of the mandible base; an
average mandible position will be used for the calculations
![Page 34: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/34.jpg)
Magnification parameter: zoom
Default value = 10x
In the case where it is unknown, the magnification can be calculated from the average recorded mandible
length for each species
![Page 35: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/35.jpg)
Finally, run the calculations program
The name of the folder must be specified; this is
the same name as the .mat file to be used
![Page 36: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/36.jpg)
Calculations: Rcrude
Mandible base, A (x1, y1)
Closed position
B (x2, y2)
Rcrude
2122
12_ yyxxleftRcrude
2
__ rightRcrudeleftRcrudeRcrude
![Page 37: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/37.jpg)
Calculations: Grid
• Select number of grid points/ possible positions of centers of rotatione.g. 40 intervals, 41 x 41 = 1,681 grid points
• Create grid centered around the calculated mandible base locationcor_values_min_x = base_coords(1,1) – Rcrude
cor_values_max_x = base_coords(1,1) + Rcrude
cor_values_min_y = base_coords(1,2) – Rcrude
cor_values_max_y = base_coords(1,2) + Rcrude
![Page 38: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/38.jpg)
Calculations: Grid
• Create a matrix with grid coordinates using values calculated for the minima and maxima in the x and y directions, as well as the interval
• Reshape the resulting 41 x 41 x 2 matrix to a matrix of size 1681 x 2 (cor_values matrix)
![Page 39: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/39.jpg)
Calculations: Rvalues
• Having established the number of iterations for the left and right centers of rotation locations, specify the number of iterations for each mandible radius (values, e.g. 200)
• Specify:Rmin = Rcrude – Rcrude/2 (50% smaller)Rmax = Rcrude + Rcrude/2 (50% larger)
• Rvalues = linspace(Rmin,Rmax,values)
![Page 40: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/40.jpg)
Calculations: Iterations
• Using nested for loops, iterate the values of x, y and R for the left and right mandibles
for # of possible radius values (values) (p)
for # of elements (41 x 41 = 1,681) (k)
for # of frames (e.g. 8) (i)
to get the RMS_error for each mandible
![Page 41: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/41.jpg)
Calculations: RMSerror
• The RMS (Root Mean Square) error is calculated from the formula *:
where radius is defined as:
and 3 is the number of free parameters (x, y, R) for each mandible
* Methodology of circle fitting using RMS error adapted from Amara Graps of Stanford University’s Solar Oscillation Investigations (http://www.mathcom.com/corpdir/techinfo.mdir/scifaq/q230.html)
3
)(),(_
pRvalueskiradius
errorRMS
22 )2,(_)2,()1,(_)1,(),( kvaluescoricoordskvaluescoricoordskiradius
![Page 42: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/42.jpg)
Calculations: Minimum RMSerror
• The resulting matrices of the left and right mandible RMS_error values are reshaped into two new matrices of size 336,200 x 1, where 336,200 = 41 x 41 x 200
• Using a simple algorithm (min command), the minimum values of the RMS_error are found (RMSleft_min & RMSright_min)
• These are used to extract the values of x, y and R where the error is minimum for each mandible
![Page 43: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/43.jpg)
Calculations: RMSerror plots
![Page 44: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/44.jpg)
Calculations: Radii & c.o.r.
![Page 45: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/45.jpg)
Calculations: ω and α
• To calculate the angular velocities and accelerations use the following formulae, based on the difference of the slopes in each frame:
θ(i) = atan [coords(i,2) – x0y0(1,2)] [coords(i,1) – x0y0(1,1)]
ω(i) = [θ(i+1) – θ(i)]*fps (rad/s)α(j) = [ω(j+1) – ω(j)]*fps (rad/s/s)
where θ(i) is the slope of each frame, ω(i) is the ang. velocity, α(j) is the ang. acceleration, and fps are the frames per sec. For n frames, there are n-1 velocity and n-2 acceleration values
![Page 46: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/46.jpg)
Calculations: u and a
• In order to convert the angular velocities and accelerations into their linear counterparts, the radius of each mandible is needed in meters:Rnew = (R/ dpi/ zoom)*0.0254(m)
• Then, the linear velocities and accelerations are:
u(i) = ω(i)*Rnew (m/s)a(j) = α(j)*Rnew (m/s/s)
![Page 47: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/47.jpg)
Calculations: Velocity Plots
![Page 48: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/48.jpg)
Calculations: Acceleration Plots
![Page 49: MATLAB Mandible Tracing & Calculations Program](https://reader035.vdocuments.mx/reader035/viewer/2022062421/56812af7550346895d8edda7/html5/thumbnails/49.jpg)
Output of Calculations Program