Use a convolution of two gaussians as a custom fit

조회 수: 4 (최근 30일)
Bill Francois
Bill Francois 2015년 6월 3일
댓글: Bill Francois 2015년 6월 11일
Hi I want to create a function that is the convolution product of two gaussian probability density functions:
f1=normpdf(x,(1-tau)*m,(1-tau*sigma))
and
f2=normpdf(x,tau*m,tau*P*sigma)
where P, sigma and m will be given, and tau will be the fit parameter.
I want to obtain the convolution product: a fuction of x that is the sum from i=0 to x of
f1(i)*f2(x-i)
And use it as a custom fit model with parameter tau.
How can I do this?
I have tried using the conv function:
function[c]=gaussienneconv3(P,tau,sigma,mu,x)
c=conv(normpdf(x,(1-tau)*mu,(1-tau)*sigma),normpdf(x,tau*mu,P*tau*sigma));
end
And then fit wit cftool and a custom fit model but even when I adjusted the size of the data vectors the fit tool did not work with this expression (he said all the points were NaN)
Then I tried with a sum expression:
function[d]=gaussienneconv4(tau,P,sigma,mu,x)
compteur=0;
for i=0:1:x
compteur=compteur+gaussienneconv1(tau,sigma,mu,i)*gaussienneconv2(P,tau,sigma,mu,x-i);
end;
d=compteur;
end
But in this case the fit tool worked but gave me a very bad fit, with a negative R-square, even when using some data computed so that they should have given me an accurate value.
Thanks in advance
Bill
  댓글 수: 1
Bill Francois
Bill Francois 2015년 6월 11일
Can anyone please help me with this issue? I am sure it is very easy for you, but I do not manage to make this fit work and it is a major problem in my biology research project.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by