In the documentation of lsqnonlin, following statement is written:
x = lsqnonlin(fun,x0,lb,ub) defines a set of lower and upper bounds on the design variables in x, so that the solution is always in the range lb ≤ x ≤ ub. You can fix the solution component x(i) by specifying lb(i) = ub(i).
How can we write this in case we want to make sure that at the end of optimization, specfic solution components are zero? Problem that I am solving is explained in detail below.
In the problem that I want to optimize, I am using an initial guess to find the location of zero (discontinuity edge) in a data using square root fitting which is not a perfect fit but a rather good guess for intial value (based on the problem and literature that I have read). Now, end goal of the optimization is to find the optimum location for the discontinuity edge. However, the function also has another lsqnonlin in it to find the coefficients around the discontinuity edge which is giving me 4x2 matrix. Values for coefficients at npower = -1 would go to zero at the discountinuity edge.
Is there a way to set the above condition in lower and upper bound for second lsqnonlin function? Attaching the code just in case someone wants to run the function. Following is the line that I used to run lsqnonlin
[cracktip,resnorm] = lsqnonlin(@(X)williamsctip(X,cracklinefit,coefs,v,u,rint,rext),200,170,sqrttip(counter2))