필터 지우기
필터 지우기

Curve fitting, setting domain/forcing asymptote

조회 수: 9 (최근 30일)
Benjamin
Benjamin 2013년 5월 17일
Playing around with data analysis. I have no experience in this area so apologies if I'm asking obvious questions.
I have two data vectors that I want to find the relationship between.
I have with cftool found an exponential function that seems to describe it fairly well. But this function gives a bunch of values outside of my physically possible domain of x-values.
Is it possible to set conditions on the function fitting? For example, I know that y will tend to infinity as x approaches 1 from the right, and y will tend to 0 as x approaches infinity.

채택된 답변

Tom Lane
Tom Lane 2013년 5월 17일
I can't think of a generic way to constrain a function to tend to infinity as x approaches 1, but you might have some luck defining a function that has that behavior and fitting it. For example:
load census % define some data having your shape
x = (cdate-1775)/10;
y = 1./pop;
ft = fittype('b1/((x-1)^b2)'); % has the desired asymptotic behavior
f = fit(x,y,ft,'start',[1 1])
plot(x,y,'bx', x,f(x),'r-') % not a great fit, but it's a start

추가 답변 (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