%this script calculates the relative frequency of each harmonic to the
%fundamental frequency.  Relative in this sense means within the same
%octave.  Also calculates the musical relationship in semitones
%(half-steps).

v = 1:15;
w = zeros(1, length(v));
for i = 1:length(v);
    y = v(i);
    x = y;
    while (x >= 2)
        x = x / 2;
    end
    w(i) = x;
end

s = 1.059463; %12th root of 2
z = log(w) / log(s);

v
w
z