If I want to get covariance matrix after some certain amount of iteration even if cmlmt doesn't get normal convergence. for example, after 100 iterations I want to print out the covpar member of the cmlmtResults structure .
Your command file has the equality constraints commented out, but you still are have inequality constraints. That line you are indicating should be commented out if you activate your equality constraints. Otherwise you need to comment out the third line down from there for inequality constraints,
out1.lagr.ineqcov = inv(ineqc*inv(h)*ineqc');
Alternatively you could change 'h' in each of this lines to 'h1' and you would not have to comment them out.
c0.maxIters = 100;
struct cmlmtResults res;
My version of your program converges after 31 iterations, so setting c0.maxIters = 100 has no effect. I set c0.maxIters == 10, and I got a covariance matrix of the parameters after those 10 iterations. I'm not sure though that it can properly be interpreted as a covariance matrix since it has been computed before convergence.
Hi, Dr. Schoenberg yes you are right. putting maxiters to some limited iteration can not be useful. but I sent you a pic that shows where the program has been stopped. you said put // in the first two columns of that line. I want to know, this line is equal as same as what you said? out1.lagr.eqcov = inv(eqc*inv(h)*eqc'); If you answer for this, the problem is solved.
There are no words to show my appreciation!
problem is solved