Octaveの実行画面で キー番号と弦長と番手(又は弦径)を入力すると
>> getInha(49, 390, 16.5) ans = 0.66496
結果が表示されます。
function inh = getInha(key, leng, ban) me = 1000; cm = 10; [di, pitch] = getDia(ban); inh = 3.3*cm^13*(di/cm)^2/(leng/cm)^4/getFreq(key, pitch)^2; end function [dia, aa] = getDia(bante) ba = 12:0.5:25; dm = 1.25:0.05:1.500; da = 0.725:0.025:1.225; di = [da dm]; dia = -1; aa = 440; if (bante < 12 && bante > 0.1) dia = bante; aa = 415; else x = find(ba == bante); if (x > 0) dia = di(x); end end end # 番手から弦径とピッチを得ます function freq = getFreq(key, pitch) freq = pitch .* 2.^((key-49)./12); end # キー番号から周波数を算出します