Optimize a stochastic process using nlinfit

Hello,
I have an issue using nlinfit in order to optimize the parameters of my model. My goal is to find the right parameters (in the vector beta) so my stochastic model fits my experimental data.
Here is my code :
function x = optim(n,Xdist,Ydist,kexp)
nbr = 100;
f=@(beta)model(beta,kexp,nbr,n)
beta0=[20,0.1,0.1]
nlinfit(Ydist,Xdist,f,beta0)
"model" returns the cumulative distribution function of my model and Xdist and Ydist stand for my experimental cumulative distribution function.
When I run it I get the error : "Error using nlinfit (line 205) Error evaluating model function '@(beta)model(beta,kexp,nbr,n)'.
Error in optim (line 10) nlinfit(Ydist,Xdist,f,beta0)
Caused by: Error using optim>@(beta)model(beta,kexp,nbr,n) Too many input arguments."
Do you know what I should change ?
Thanks for your help.

Answers (1)

f=@(beta,x)model(beta,x,kexp,nbr,n)
Best wishes
Torsten.

Categories

Find more on Programming in Help Center and File Exchange

Asked:

on 2 Mar 2017

Answered:

on 3 Mar 2017

Community Treasure Hunt

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

Start Hunting!