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

2 Ansichten (letzte 30 Tage)
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

Akzeptierte Antwort

John D'Errico
John D'Errico am 27 Mai 2016
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.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with Curve Fitting Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by