Art
Art

Reputation: 1335

matlab: lsqcurvefit, only one upper bound

simple question.. Is it possible to set only one upper bound for lsqcurvefit, without limiting others?

I need something like:

lb = [0 0 0];
ub = [~ ~ 5];

Thanks!

Upvotes: 1

Views: 1703

Answers (1)

Rody Oldenhuis
Rody Oldenhuis

Reputation: 38032

From help lsqcurvefit:

X = LSQCURVEFIT(FUN,X0,XDATA,YDATA,LB,UB) defines a set of lower and

upper bounds on the design variables, X, so that the solution is in the
range LB <= X <= UB. Use empty matrices for LB and UB if no bounds
exist. Set LB(i) = -Inf if X(i) is unbounded below; set UB(i) = Inf if
X(i) is unbounded above.

So yes, Dan Becker is right -- using

lb = [   0  0  0];
ub = [inf inf  5]; 

will do the trick.

Upvotes: 4

Related Questions