Is there an option in lsqcurvefit function in matlab to set different limits to each of the best fit coefficients ?

6 次查看(过去 30 天)
Hi
I have used to lsqcurvefit to find the best fit 3 coefficients of a function. I need to set different limit to each of the 3 coefficients. Is there any provision for it? I find that you can set one limit to all the 3 coefficients but not individually. Please help me incase it is possible.
Thanks Nadia

采纳的回答

John D'Errico
John D'Errico 2016-5-27
Of course you can set "bounds" on the variables. But no, you are wrong that they must all be the same value. If x is the unknown vector, say of length 2 in this case, say we wanted the lower bound on x(1) to be zero, and x(2) will be unbounded from below. Then the lb argument in this case would be:
lb = [0,-inf];
Similarly, suppose we had upper bounds on x of 10 for x(1), and 5 for x(2).
ub = [10,5];
You can set the bounds to be any values you like of course. They need not all be the same. As you can see, if a variable has no lower or upper bound, then use -inf or +inf respectively.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by