![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1069710/image.png)
I want to find the best coefficients for curve fitting for my experiment data
조회 수: 1 (최근 30일)
이전 댓글 표시
Greetings
I have experiment data as you can see below, I want to find the curve with the formula of y=K0+K1exp(-t/Tau) which is fit to my experiments data.
I have 'y' and 't' from experiment and I am looking for the best values for K0, K1 and Tau.
the bellow is the graph of my experiment data
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1069670/image.jpeg)
댓글 수: 0
채택된 답변
Image Analyst
2022년 7월 18일
You can use fitnlm if you have the stats toolbox. See attached demo and make changes as needed, like reading in your actual data, and renaming variables if you want.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1069710/image.png)
추가 답변 (2개)
Torsten
2022년 7월 18일
Your code ?
Essential in your case is a good starting guess for the parameters.
Try the following code and take the coefficients as initial values for the optimization.
fun = @(K0,K1,tau,t) K0 + K1*exp(-t/tau);
t = 0:0.1:10;
K0 = 1e10;
K1 = 6.2e10;
tau = 4.5;
y = fun(K0,K1,tau,t);
plot(t,y)
참고 항목
카테고리
Help Center 및 File 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!