Solve Compartmental Model with lsqcurvefitting
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
My question is about the following convolution:
C(t) = Ca(t) x K1*exp(-k2*t)
where x is the convolution. I have the x- and y-values of the signals C(t) and Ca(t). With a least squares estimation, I want to estimate the parameters K1 and k2.
I started this with the function lsqcurvefitting, for which I first set up the following function, like the example in the help file
function F = myfun(x,xdata)
F = (x(1)*exp(x(2)*xdata));
But, the problem is that I have two sets of xdata and two sets of ydata (from C(t) and Ca(t)). Is this problem even possible to solve with the lsqcurvefitting? because if I want to solve this with the following code, it does not like the function at all (and that is because I totally skipped the convolution with Ca(t), but I don't know how to implement this).
K0 = [0.02; 0]; % Starting guess
[K,resnorm] = lsqcurvefit(@myfun,K0,xdata,ydata)
Btw, the xdata and ydata mentioned in this script is from the C(t) dataset.
Hope this problem is clear to you. Thanks in advance :)
2 commentaires
Réponses (1)
Matt J
le 7 Oct 2013
For a fixed k2, you should be able to do a numerical convolution using TRAPZ within your F(x,xdata) function.
Since your K1 function only affects the objective function linearly, you might also consider using
instead of LSQCURVEFIT.
0 commentaires
Voir également
Catégories
En savoir plus sur Numerical Integration and Differentiation dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!