필터 지우기
필터 지우기

i want to do non linear fitting using the function y=ae^(-bt) + C

조회 수: 6 (최근 30일)
Vinit
Vinit 2014년 8월 4일
댓글: Nade Sritanyaratana 2014년 8월 4일
I want to fit the non linear data using the function mentioned above. how do i get the values of a,b, & c. I have attached the text file which has my data.
Thank you.

답변 (1개)

Nade Sritanyaratana
Nade Sritanyaratana 2014년 8월 4일
Have you already parsed t and y from the text file?
I would suggest custom nonlinear fitting since it looks like you want to fit an exponential curve with a constant additive term. Here's a doc page about using CFTOOL to do this.
To do this programmatically, you can use a custom fit.
For example, for the function you are using, I would define a fittype like this:
f = fittype( @(a, b, C, t) a*exp(-b*t) + C);
coeffs = fit(t, y, f);
a = coeffs.a;
b = coeffs.b;
C = coeffs.C;
Make sure that t and y are column vectors. Good luck!
  댓글 수: 2
Vinit
Vinit 2014년 8월 4일
Yes i have the t and y as separate cells
Nade Sritanyaratana
Nade Sritanyaratana 2014년 8월 4일
What do t and y look like? Can you print the output of both?
You will need to convert t and y to column vectors but the method to do so will depend on how they are currently stored.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by