function [par,r1]=estdiff(c,g,dt,z)
%estimates diffusion parameters c,g and then for them, a,b.
options = foptions;
options(1)=1;
options(2)=.01;
options(3)=.01;
options(4)=.01;
options(5)=0;
options(14)=100;
%[par,options]=fsolve('graddiff',[c,g],options,[],dt,z);
%[par,options]=fsolve('graddiff',par,options,[],dt,z);
% For demonstratin purposes we do not alter the parameters
par=[c,g];
[a,b,dz,w]=estdrift(par(1),par(2),dt,z);
par=[a b par];
disp(['parameter estimates ' num2str(a) ' '  num2str(b)  ' '  num2str(par(3))  ' '  num2str(par(4))])
[r1,r2]=resid7(par(4),a,b,par(3),dt,z,w);