function [par,r1,r2]=estpar(c,g,dt,z) %for fixed value of g, estimates other three parameters a,b,c n=length(z)-1; z1=z(1:n); [a,b,dz,w]=estdrift(c,g,dt,z); m = ( a + b*z1).*(exp(b*dt) - 1)/b; w=w.^2; y = ((dz-m).^2); [c,opt]=fmin('estc',.0005, .1, [], z1,y,g,dt,w); w=weight(c,g,dt,z); [r1,r2]=resid7(g,a,b,c,dt,z,w); par=[a b c g log(opt(8)) log(ss(r1)) log(ss(r2))];