matlab:lsqcurvefit,只有一个上界

时间:2012-10-30 04:51:28

标签: matlab least-squares

简单问题..是否可以只为lsqcurvefit设置一个上限,而不限制其他上限?

我需要类似的东西:

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

谢谢!

1 个答案:

答案 0 :(得分:4)

来自help lsqcurvefit

  

X = LSQCURVEFIT(FUN,X0,XDATA,YDATA,LB,UB)定义了一组较低的

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.

所以是的,Dan Becker是对的 - 使用

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

会做到这一点。