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

(starting at 0)<br />

Returns:<br />

A vector <strong>of</strong> Harmonic structs, one for each existent harmonic for<br />

the particular Minimum in question.<br />

*/<br />

double harmAvgZ(Vector harmv);<br />

/*<br />

Calculates the weighted average <strong>of</strong> the impedance levels for the<br />

first HARMONICS_AVERAGED number <strong>of</strong> harmonics in a given set. Each<br />

harmonic in the vector contains its integer frequency ratio<br />

(relative to an anonymous minimum), <strong>and</strong> its impedance level. An<br />

integer ratio <strong>of</strong> 2 (the second harmonic) has a relative weight <strong>of</strong><br />

1/2. An integer ratio <strong>of</strong> 3 (the third harmonic) has a relative<br />

weight <strong>of</strong> 1/3, <strong>and</strong> so on.<br />

Parameters:<br />

harmv: the vector <strong>of</strong> Harmonic structs for a particular minimum<br />

Returns:<br />

The weighted average <strong>of</strong> their impedance levels as a double<br />

*/<br />

double* harmonicsArray(Vector minv, int pos);<br />

/*<br />

Calculates the frequency ratios <strong>of</strong> minima following a particular<br />

Minimum.<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<br />

(starting at 0)<br />

Returns:<br />

An array <strong>of</strong> doubles, one for each minimum following the Minimum<br />

in question. Each double is the frequency <strong>of</strong> the higher minima<br />

divided by the frequency <strong>of</strong> the Minimum in question.<br />

*/<br />

double invalidNum(void);<br />

/*<br />

Gives the result <strong>of</strong> at<strong>of</strong>("+NAN").<br />

Returns:<br />

A double representing NaN.<br />

*/<br />

int isValidNum(double d);<br />

/*<br />

Evaluates whether a number is valid. NaN <strong>and</strong> inf values are invalid.<br />

Parameters:<br />

d: the double to evaluate<br />

Returns:<br />

1 if valid, 0 otherwise<br />

*/<br />

double det(double** M);<br />

/*<br />

Calculates the determinant <strong>of</strong> a 3x3 matrix.<br />

Parameters:<br />

M: a 2 dimensional double array representing the matrix.<br />

Returns:<br />

The determinant <strong>of</strong> M as a double.

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

Saved successfully!

Ooh no, something went wrong!