function [out, cf] = frac_oct(signal,bandwidth,Fs,draw,ref)
bank = octaveFilterBank(bandwidth,"SampleRate",Fs);
cf = getCenterFrequencies(bank);
if~exist ('ref','var')
    ref = 1;
    SPL = false;
else
    SPL = true;
end
filtered = bank(signal);

rms = calc_rms(filtered,size(filtered,2));

out = calculate_db(rms,ref.*ones(length(rms),1),SPL);
if (draw==true)
    lcf = log10(cf);
    b = bar(lcf,out);
    b.BarWidth = 0.5;
    title('Fractional octave bands','Interpreter','latex')
    xticklabels(string(round(cf,1)));
    xticks(lcf)
    xlabel ('Frequency (Hz)','Interpreter','latex')
    if (SPL==true)
    ylabel ('Level dB(SPL)','Interpreter','latex')
    b.BaseValue = 0;
    else
    ylabel ('Level (dBFS)','Interpreter','latex')
    b.BaseValue = -100;
    end
    set(gca,'TickLabelInterpreter','latex')
    set(gca,"FontSize",21)
    grid on
end




