%
disp(' ');
disp(' fill_factor.m  ver 1.3  May 6, 2011 ');
disp(' by Tom Irvine  Email: tomirvine@aol.com ');
disp(' ');
disp(' Reference: NASA-HBBK-7005 ');
%
clear fc;
clear FF;
%
disp(' ');
iu = input(' Enter units:  1=English 2=metric ');
disp(' ');
%
V=input(' Enter the volume ratio ( must be < 1. ) ');
disp(' ');
if(iu==1)
    c = input(' Enter the speed of sound (ft/sec) ');
    c = c*12;
    disp(' ');
    H = input(' Enter the distance between the payload and the fairing wall (inch) ');
    out1=sprintf(' C=%8.4g ft/sec    H=%6.4g inch    V=%6.4g  ',c/12,H,V);    
else
    c = input(' Enter the speed of sound (m/sec) ');
    disp(' ');
    H = input(' Enter the distance between the payload and the fairing wall (cm) ');
    H=H/100;
    out1=sprintf(' C=%8.4g m/sec    H=%6.4g cm    V=%6.4g  ',c,H*100,V);    
end
disp(' ');
%
[fc,imax]=octaves(2);
%
for(i=1:imax)
    alpha=c/(2*fc(i)*H);
    num=1+alpha;
    den=1+alpha*(1-V);
    FF(i)=10*log10(num/den);
end
%
figure(1);
plot(fc,FF);
ylabel(' Fill Factor (dB) ');
xlabel(' Frequency (Hz)');
grid('on');
set(gca,'MinorGridLineStyle','none','GridLineStyle',':','XScale','log','YScale','lin');
title(out1);