Effacer les filtres
Effacer les filtres

I want to find the best coefficients for curve fitting for my experiment data

1 vue (au cours des 30 derniers jours)
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

Réponse acceptée

Image Analyst
Image Analyst le 18 Juil 2022
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.

Plus de réponses (2)

Torsten
Torsten le 18 Juil 2022
Try "lsqcurvefit".
  1 commentaire
Misi
Misi le 18 Juil 2022
Modifié(e) : Misi le 18 Juil 2022
Thank you
I used the lsqcurve fit but it couldnot fit on my curve and the final asnwer was zero for all coeffiecient.
This what I recieved in command window
Initial point is a local minimum.
Optimization completed because the size of the gradient at the initial point
is less than the default value of the optimality tolerance.
<stopping criteria details>
a =
0
b =
0
c =
0

Connectez-vous pour commenter.


Torsten
Torsten le 18 Juil 2022
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)

Catégories

En savoir plus sur Get Started with Curve Fitting Toolbox 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!

Translated by