필터 지우기
필터 지우기

How to fit a curve with forced initial value

조회 수: 21 (최근 30일)
Philippe
Philippe 2011년 10월 24일
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.

채택된 답변

Richard Willey
Richard Willey 2011년 10월 24일
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개)

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by