Fit Curve to a user defined function
显示 更早的评论
Hello,
I have 2 defined variables, S and u, both with experimental data shown below:
S =
0.403000000000000
0.331000000000000
0.270400000000000
0.222200000000000
0.181600000000000
0.148900000000000
0.122100000000000
0.100500000000000
0.080800000000000
0.067000000000000
0.054000000000000
0.045200000000000
0.036300000000000
0.029500000000000
0.024800000000000
0.020100000000000
0.016400000000000
0.014200000000000
0.011900000000000
0.008800000000000
0.008000000000000
0.005100000000000
0.005100000000000
u =
0.957033515000000
0.903278685000000
0.815542061000000
0.732249907000000
0.656767397000000
0.578471565000000
0.506853196000000
0.440901480000000
0.379658753000000
0.324856464000000
0.276170883000000
0.233324443000000
0.196245474000000
0.164407417000000
0.137095397000000
0.113974220000000
0.094601760000000
0.078298766000000
0.064655532000000
0.053307707000000
0.043933989000000
0.036147733000000
0.029677689000000
I want to fit them to the Monod Equation using programmatic curve fitting, where the monod equation is given as u = (umax*S)/(Ks+S), where umax and Ks are constants.
However, I do not know how to define the Monod Equation as a function in MATLAB so that I can fit u and S to it, because I need to do so to obtain the 95% prediction intervals, instead I end up with the following error messages instead:
>>[fitresult,gof] = fit(S,u,'Monod');
Error using fittype>iCreateFromLibrary (line 414)
Library function Monod not found.
Error in fittype>iCreateFittype (line 345)
obj = iCreateFromLibrary( obj, varargin{:} );
Error in fittype (line 330)
obj = iCreateFittype( obj, varargin{:} );
Error in fit>iFit (line 165)
model = fittype( fittypeobj, 'numindep', size( xdatain, 2 ) );
Error in fit (line 116)
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...
and
>> [fitresult,gof] = fit(S,u,'u = (umax*S)/(Ks+S)')
Error using fittype>iDeduceCoefficients (line 621)
The independent variable x does not appear in the equation expression.
Use x in the expression or indicate another variable as the independent variable.
Error in fittype>iCreateCustomFittype (line 477)
obj = iDeduceCoefficients(obj);
Error in fittype>iCreateFittype (line 353)
obj = iCreateCustomFittype( obj, varargin{:} );
Error in fittype (line 330)
obj = iCreateFittype( obj, varargin{:} );
Error in fit>iFit (line 165)
model = fittype( fittypeobj, 'numindep', size( xdatain, 2 ) );
Error in fit (line 116)
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...
How would you all solve this problem?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File 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!

