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 259<br />

}<br />

}<br />

if(ascent) {<br />

seq_dec++;<br />

seq_inc--;<br />

}<br />

}<br />

}<br />

return extv;<br />

Extremum parabolaExt(Vector points, minmax type, int weight) {<br />

Extremum ext = (Extremum)malloc(size<strong>of</strong>(*ext));<br />

int numext;<br />

double a, b, c, delta;<br />

double x0, y0;<br />

double minf;<br />

double maxf;<br />

/* compute least squares parabolic fit from data vector */<br />

delta = det(D(points));<br />

a = (1.0/delta)*det(A(points));<br />

b = (1.0/delta)*det(B(points));<br />

c = (1.0/delta)*det(C(points));<br />

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

ext->type = MINIMUM;<br />

/* determine analytical minimum from parabola fit */<br />

x0 = -1.0*(b/(2.0*c));<br />

y0 = a + b*x0 + c*x0*x0;<br />

if(weight) {<br />

/* find frequency <strong>of</strong> absolute minimum in data vector */<br />

minf = lowest(points);<br />

numext = numExtrema(points, MINIMUM);<br />

/* if only one minimum in set, heavily weight to absolute<br />

minimum */<br />

if(numext == 1) {<br />

ext->f = (x0*minf)/(0.95*x0 + 0.05*minf);<br />

}<br />

/* otherwise, moderately weight towards absolute minimum */<br />

else {<br />

ext->f = (x0*minf)/(0.75*x0 + 0.25*minf);<br />

}<br />

}<br />

/* if weight is false, use fit to determine f */<br />

else<br />

ext->f = x0;<br />

/* construct minimum ...<br />

impedance is parabola minimum<br />

b<strong>and</strong>width <strong>and</strong> Q factor is 3dB span <strong>of</strong> parabola */<br />

ext->Z = y0;<br />

ext->B =

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

Saved successfully!

Ooh no, something went wrong!