필터 지우기
필터 지우기

Fit an equation with an integral

조회 수: 2 (최근 30일)
thatguy14
thatguy14 2015년 11월 2일
댓글: thatguy14 2015년 11월 2일
I have an equation that I am trying to find the best way to fit. In its original form it is:
A * convolution (func1,func2) from 0 to t or put correctly:
A* integral from 0 to t of (function 1(t')*exp(-A*(t-t')/B)dt')
Function 2 has two fit parameters I wish to recover. Function 1 is just a function of time and I have a curve for it.
I thought it might be easier to split the convolution as follows:
exp(-A(t-t')/B) = exp(-At/B)*exp(At'/B) and took out the first exponential since it is not a function of t'. I then tried to fit this, here is my code
kineticModel = @(ve,Ktrans,x) Ktrans.*exp(-Ktrans.*x./ve).*integral(@(x) Cpt(x).*exp(Ktrans.*x./ve),timePoints(1)./60,timePoints(end)./60);
[kineticFit, GOF] = fit((timePoints./60)',Ct',kineticModel);
This is giving me an error (subscript indicies must be real or positive integers or something similar. I found this is coming from the Cpt(x) term.
To be honest I am not sure this is correct since it was originally a convolution. the integral is actually a function on its own as a function of t (0 to t1, 0 to t2 etc). I am trying to avoid the convolution since it is the discrete version and requires scaling by the spacing (the spacing of my time points is not linear).
Any help would be appreciated. Let me know if anything needs clarification.

답변 (1개)

Star Strider
Star Strider 2015년 11월 2일
How did you define your ‘Cpt’ function?
Where did you define it (anonymous function or its own function file)?
  댓글 수: 1
thatguy14
thatguy14 2015년 11월 2일
Yea I just realized I had forgot to define it as a anonymous function. That would fix it but I don't quite think that it will work how I want it to anyways... I may have to rethink this.

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

카테고리

Help CenterFile 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!

Translated by