How to fit a curve with forced initial value
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dear everybody,
I'm trying to fit a serie of datapoints with a function f(x) (e.g. a polynomial function)by forcing the value of the function at x=0. I tried to find the solution using "fit" and "polyfit" Matlab functions but the interpolating algorithm doesn't seem to take into account the initial value that I want. Could you help me ? Thanks by advance.
0 commentaires
Réponse acceptée
Richard Willey
le 24 Oct 2011
Hi Phillippe
If you have Statistics Toolbox or Curve Fitting Toolbox its relatively easy to force this type of constraint.
Here's a simple example using Curve Fitting Toolbox where I constrain the intercept to take the value "4" by setting the upper and lower bound for the regression coefficient to be 4.
X = 1:100
X = X'
Y = 3* X + 5 + randn(100,1)
foo = fit(X, Y, 'poly1', 'Lower', [-Inf 4], 'Upper', [Inf 4])
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Interpolation 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!