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

/*<br />

Reads the next data point present in the impedance spectra file, <strong>and</strong><br />

places this within a window <strong>of</strong> data points - also shifting the<br />

window to the right by one point <strong>and</strong> popping the leftmost data<br />

point.<br />

Parameters:<br />

points: the window <strong>of</strong> data points that the function updates.<br />

allpoints: the vector <strong>of</strong> all data points.<br />

index: the next point in the allpoints vector to read.<br />

Returns:<br />

1 if successful, 0 otherwise (such as EOF reached).<br />

*/<br />

int numExtrema(Vector points, minmax type);<br />

/*<br />

Calculates the number <strong>of</strong> local extrema in the given Vector window.<br />

Parameters:<br />

points: the window <strong>of</strong> data points that the function processes.<br />

type: a minmax type indicating minimum/maximum.<br />

Returns:<br />

The number <strong>of</strong> local extrema.<br />

*/<br />

double lowest(Vector points);<br />

/*<br />

Evaluates the frequency <strong>of</strong> the lowest y value among a set <strong>of</strong> data<br />

points.<br />

Parameters:<br />

points: a Vector <strong>of</strong> Points<br />

Returns:<br />

A double <strong>of</strong> the frequency <strong>of</strong> the lowest y value among points<br />

*/<br />

double highest(Vector points);<br />

/*<br />

Evaluates the frequency <strong>of</strong> the highest y value among a set <strong>of</strong> data<br />

points.<br />

Parameters:<br />

points: a Vector <strong>of</strong> Points<br />

Returns:<br />

A double <strong>of</strong> the frequency <strong>of</strong> the highest y value among points<br />

*/<br />

void harmonicity(Vector minv);<br />

/*<br />

Sets the harmonicity variables numharm <strong>and</strong> meanharmZ<br />

for each Minimum struct in a given minima vector.<br />

Parameters:<br />

minv: the vector <strong>of</strong> Minimum structs to be updated<br />

*/<br />

Vector harmonics(Vector minv, int pos);<br />

/*<br />

Evaluates the harmonics <strong>of</strong> a particular Minimum struct in a<br />

given minima vector.<br />

Parameters:<br />

minv: the vector <strong>of</strong> Minimum structs for a particular data file<br />

pos: the index <strong>of</strong> the required Mimimum struct in the vector

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

Saved successfully!

Ooh no, something went wrong!