No BSD License  

Highlights from
Octave centre frecuencies

from Octave centre frecuencies by Eleftheria
Calculation of centre frequencies for 1/(fr)-octave

centr_freq(fr)
% Function that calculates the exact centre frequencies,  for 1/fr-octave
% bands, and also the lower and upper edge of every frequency band (from
% 20Hz to 20 KHz)
% 
% Example: [f_c,fc_1,fc_2]= centr_freq (3). Calculates and returns the centre frequencies for 1/3
% octave band, and also the lower and upper edge band frequencies, from 20Hz to 20 KHz. 


function [fc,fc_1,fc_2] = centr_freq(fr)

% Calculate the center frequencies for 1/fr Band.
f_ab(1)=1000;
f_bl(1001)=1000;

for n=1:1:1000          %center frequencies over 1000Hz
    f_ab(n+1)=f_ab(n)*10^(3/(10*fr));
end
for i=1:1:length(f_ab)
    if f_ab(i)>22000;
        f_ab(i)=0;
    end
end
f_ab =f_ab(1: max(find(f_ab)));

for j=1000:-1:1           % center frequencies below 1000Hz
    f_bl(j)=f_bl(j+1)/(10^(3/(10*fr)));
end

for k=1:1:length(f_bl)
    if f_bl(k)<20;
        f_bl(k)=0;
    end
end
f_bl =f_bl(min(find(f_bl)): (max(find(f_bl))-1));
fc = [f_bl,f_ab];            %center frequencies


fc_1 = fc / 2^(1/(2*fr));          %lower edge band frequencies
fc_2 = fc * ( 2^(1/(2*fr)) );      %upper edge band frequencies


Contact us at files@mathworks.com