function cdffit(data,ndist,p1,p2)
 close all
 
% Problem Set 4
% Question 1 function
% in command window or other program, write (for example):
% load arsenic.txt
% cdffit(arsenic,2,110,0)

figure
cdfplot(data)
hold
x=0:.1:max(data);

if ndist==1
    y=unifcdf(x,p1,p2);
    title('Actual and Theoretical Uniform CDF for Bangladesh Data')
end

if ndist==2
    y=expcdf(x,p1);
    title('Actual and Theoretical Exponential CDF for Bangladesh Data')
end


if ndist==3
    y=normcdf(x,p1,p2);
    title('Actual and Theoretical Normal CDF for Bangladesh Data')
end


if ndist==4
    y=logncdf(x,p1,p2);
    title('Actual and Theoretical Lognormal CDF for  Arsenic Data')
end


plot(x,y,'--')
legend('Actual','Theoretical')
xlabel('Contaminant Level [ug/L]')
ylabel('F(x)')

return