%% fdmin.m is the chi square function that dfpar.m minimises.

function cs=fdmin(cf,xv,fdd)

fd=fedi(cf,xv);
cs=sum((fd-fdd).^2);