Superimposing Data onto Plot

1 view (last 30 days)
nelly3other
nelly3other on 9 Sep 2013
This is what I did in MATLAB:
plot (x,y,'r.');
modelFun = @(p,time) p(1)*exp(-p(2)*time)+p(3)*exp(-p(4)*time);
startingVals = [1,1,0,1];
>> fitobject=fit(x,y,modelFun, startingVals)
and I get the following error message:
Error using fit>iParseOptionalArgs (line 975)
Algorithm options must be specified in a FITOPTIONS object or as property-value pairs.
Error in fit (line 105)
[useroptions, useroptargs, probparams] = iParseOptionalArgs( varargin{:} );
Could anyone please show me where I am going wrong? I would really appreciate any help in moving from here.
Thanks so much!

Answers (1)

Walter Roberson
Walter Roberson on 9 Sep 2013
fitobject = fit(x, y, modelFun, 'StartingPoint', startingVals)

Community Treasure Hunt

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

Start Hunting!