Effacer les filtres
Effacer les filtres

How to set a parameter lower bound during curve fitting?

56 vues (au cours des 30 derniers jours)
Alexandria Will-Cole
Alexandria Will-Cole le 25 Juil 2018
Hello, I want to set the lower bound for my p2 variable as 0, because a negative value is unphysical for my data set.
Here is my code:
rho=Resistivityohmcm; T=TemperatureK;
plot(T,rho,'-o')
x=T; y=rho;
fnPolySq=@(p1,p2,x) p1*x.^2 + p2; %fit(x,y,fnPolySq) mask = x > 135 ; %restricts the data fit to before the upturn
f = fit(x(mask), y(mask), fnPolySq ); plot(f, T, rho)
plot(f,T,rho) disp (f)
Thanks!

Réponse acceptée

Adam Danz
Adam Danz le 25 Juil 2018
Modifié(e) : Adam Danz le 25 Juil 2018
Here's how you set bounds using fit()
See 'Lower'.
  3 commentaires
Adam Danz
Adam Danz le 25 Juil 2018
In the line of code you shared, I don't see where you've implemented the 'Lower' parameter. See the link again and read the section, " 'Lower' — Lower bounds on coefficients to be fitted"
Alexandria Will-Cole
Alexandria Will-Cole le 25 Juil 2018
Thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with Curve Fitting Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by