Dear all,
I have discrete data A(x,y), which I want to fit by a specified function y=f(x). My function f(x) has the following restriction: df(x)/dlog(x) is equal to a sum of two Gaussians. df(x)/dlog(x) being the derivative of f(x) with respect to the argument log(x). Given this restriction f(x) can be expressed as an integral. This gives 6 fit parameters, namely: the heights of the Gaussians, their means and their standard deviations. I have gone this far:
par=[1e-9,1e-5,1,10000,1,1]; %initial Gaussian parameter guess
Integrand = @(x) ((par(3)/(par(5)*(2*pi)^0.5))*exp((-(log10(x)-log10(par(1))).^2)/(2*par(5)^2))+(par(4)/(par(6)*(2*pi)^0.5))*exp((-(log10(x)-log10(par(2))).^2)/(2*par(6)^2)))./(x*log(10)); %two gaussians
Integral = @(x) integral(Integrand,0,x);nlinfit(A(:,1),A(:,2),Integral,par)
I however get the following error:
Error using nlinfit (line 142)Error evaluating model function '@(x)integral(Integrand,0,x)'.Caused by: Error using @(x)integral(Integrand,0,x) Too many input arguments.
How can I fix this? Thank you
Best Answer