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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

APPENDIX B. PROGRAM LISTINGS 250<br />

Minimum m;<br />

Vector minv = createVector();<br />

/* for each minimum in extrema list */<br />

for(i = 0; i < sizeVector(extv); i++) {<br />

e = (Extremum)elementAt(extv, i);<br />

if(e->type == MINIMUM) {<br />

/* create Minimum struct with same f, Z, B */<br />

m = (Minimum)malloc(size<strong>of</strong>(*m));<br />

m->f = e->f;<br />

m->Z = e->Z;<br />

m->B = e->B;<br />

/* search for left maximum <strong>and</strong> calculate df, dZ */<br />

for(j = i - 1; j >= 0; j--) {<br />

searche = (Extremum)elementAt(extv, j);<br />

if(searche->type == MAXIMUM) {<br />

m->L_max_df = e->f - searche->f;<br />

m->L_max_dZ = searche->Z - e->Z;<br />

break;<br />

}<br />

}<br />

/* if none found, set to nan */<br />

if(j < 0) {<br />

m->L_max_df = invalidNum();<br />

m->L_max_dZ = invalidNum();<br />

}<br />

/* search for left minimum <strong>and</strong> calculate df, dZ */<br />

for(j = i - 1; j >= 0; j--) {<br />

searche = (Extremum)elementAt(extv, j);<br />

if(searche->type == MINIMUM) {<br />

m->L_min_df = e->f - searche->f;<br />

m->L_min_dZ = searche->Z - e->Z;<br />

break;<br />

}<br />

}<br />

/* if none found, set to nan */<br />

if(j < 0) {<br />

m->L_min_df = invalidNum();<br />

m->L_min_dZ = invalidNum();<br />

}<br />

/* search for left maximum <strong>and</strong> calculate df, dZ */<br />

for(j = i + 1; j < sizeVector(extv); j++) {<br />

searche = (Extremum)elementAt(extv, j);<br />

if(searche->type == MAXIMUM) {<br />

m->R_max_df = searche->f - e->f;<br />

m->R_max_dZ = searche->Z - e->Z;<br />

break;<br />

}<br />

}<br />

/* if none found, set to nan */<br />

if(j >= sizeVector(extv)) {<br />

m->R_max_df = invalidNum();<br />

m->R_max_dZ = invalidNum();<br />

}<br />

/* search for left minimum <strong>and</strong> calculate df, dZ */<br />

for(j = i + 1; j < sizeVector(extv); j++) {<br />

searche = (Extremum)elementAt(extv, j);<br />

if(searche->type == MINIMUM) {

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

Saved successfully!

Ooh no, something went wrong!