필터 지우기
필터 지우기

Solve Compartmental Model with lsqcurvefitting

조회 수: 3 (최근 30일)
Inge
Inge 2013년 10월 7일
답변: Matt J 2013년 10월 7일
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
Matt J
Matt J 2013년 10월 7일
Are the xdata uniformly spaced?
Inge
Inge 2013년 10월 7일
No, but the xdata for both C(t) and Ca(t)is spaced in the same, non-uniformly manner. This is the xdata:
0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 110 120 130 140 150 160 170 180 190 200 250 300 350 400 450
500 550 600 695 790

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

답변 (1개)

Matt J
Matt J 2013년 10월 7일
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.

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by