Hello everyone!
I have a problem with fmincon violating the constraints, as I know during the
optimization fmincon can violate it's constraints but I think that this
makes me problems. One of my constraints is that the output vector should be
nondecreasing because my objective function use spcol routine which fails if I
pass decreasing point sequence.
To solve this problem I sort fmincon output vector before I pass it to my
ojective function but I'm not sure if I may do this? Doesn't this
sorting costs problems in fmincon's result?
Here is more precise what I do:
>>
function J=objfun1(knot, param, k, P)
knot=sort(knot);
param=sort(param);
M=spcol(knot, k, param);
Mplus=pinv(M);
d=Mplus*P;
C=spmak(knot, d');
Cprim=fnder(C);
ff=fnval(Cprim, param);
norma(1,:).^2+ff(2,:).^2;
length=trapz(norma);
J=length;
>>
where knot and param are parameters that I change during the optimization.
Thanks
Didi