options=optimset('MaxFunEvals', 10000, 'MaxIter', 10000, 'TolFun', 0.0001, 'TolX',0.0001,'Display','on'); [k_optim, resnorm, residual, exitflag, output, lambda, jacobian] = lsqnonlin(f,k0,lb,ub,options);

From the equations in the added file, I want to estimate the parameters k_i, K_j, EA_i, dH_j (12 parameters in total) which appear in r. r appears in the differential equation dy/dz. I have 240 values of y at z=0 and at z=end of reactor. The latter is my dependent variable. The ys at z=0 flow together with the coefficients as dependent variable into the model. The jacobian I get from the code estimated above now has 720 rows and 12 columns. Since J_ij = dy_i/(dcoefficient of parameter j) it should only have 240 rows, as there are observations. J is a double sparse matrix. Anyone has an idea why it has 3 times more rows?