% Input time interval [t0,T] and time step. Generate time grid. tgrid=time; % Generate the initial condition y0=d_model(1); yp0=dydt(1); w0=[y0;yp0;0;0;0;0]; [t,w]=ode45(@RHSfunction,tgrid,w0,[],K,C); %y=w(:,1) %figure %plot(tgrid,y) %title('the solution y') dy_dk=w(:,3) %figure %plot(tgrid,dy_dk) %title('the sensitivity of the solution with respect to k') dy_dc=w(:,5) %figure %plot(tgrid,dy_dc) %title('the sensitivity of the solution with respect to c') xmat=[dy_dc, dy_dk]; estimateofsigma; covest=sigma2.*inv(xmat'*xmat); std_c=sqrt(covest(1, 1)); std_k=sqrt(covest(2, 2));