11.07.2014 Views

Flute acoustics: measurement, modelling and design - School of ...

Flute acoustics: measurement, modelling and design - School of ...

Flute acoustics: measurement, modelling and design - School of ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

APPENDIX B. PROGRAM LISTINGS 252<br />

}<br />

if(descent && ascent) {<br />

/* run parabola least squares fit on points, add minimum to<br />

vector */<br />

for(j = 0; j < (NUM_POINTS/2 - TWEAK); j++) {<br />

progressPoints(points, allpoints, i);<br />

i++;<br />

}<br />

e = parabolaExt(points, MINIMUM, WEIGHT);<br />

if(e != NULL)<br />

addElement(extv, e);<br />

/* reset flags <strong>and</strong> remember we're ascending */<br />

seq_inc = 0;<br />

seq_dec = 0;<br />

descent = 0;<br />

ascent = 1;<br />

}<br />

/* if graph decreases... */<br />

if(((Point)elementAt(points, sizeVector(points) - 1))->y<br />

< ((Point)elementAt(points, sizeVector(points) - 2))->y) {<br />

}<br />

/* tally number <strong>of</strong> points increased ... set flag when<br />

we have moved up far enough to expect minimum/maximum */<br />

seq_dec+=2;<br />

if(seq_dec/2 >= TWEAK)<br />

descent = 1;<br />

if(seq_inc/2 > 0)<br />

seq_inc-=2;<br />

if(ascent && descent) {<br />

/* run parabola least squares fit on points, add minimum to<br />

vector */<br />

for(j = 0; j < (NUM_POINTS/2 - TWEAK); j++) {<br />

progressPoints(points, allpoints, i);<br />

i++;<br />

}<br />

e = parabolaExt(points, MAXIMUM, WEIGHT);<br />

if(e != NULL)<br />

addElement(extv, e);<br />

/* reset flags <strong>and</strong> remember we're descending*/<br />

seq_inc = 0;<br />

seq_dec = 0;<br />

descent = 1;<br />

ascent = 0;<br />

}<br />

/* if graph neither increases nor decreases... */<br />

if(((Point)elementAt(points, sizeVector(points) - 1))->y<br />

== ((Point)elementAt(points, sizeVector(points) - 2))->y) {<br />

if(descent) {<br />

seq_inc++;<br />

seq_dec--;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!