Error while declaring a fit-type
Show older comments
Can somebody tell me why using the following expression:
myfittype = fittype(...
'(integral(@(xi)( (1/pi*(0.1375*sqrt(2*pi)))*exp(-(xi-2.75).^2/(2.0*0.01890625))./((xval+0.09793600169767440*2*xi-1.34484937381768000).^2+d^2) ),0,1/0))',...
'dependent',{'y'},'independent',{'xval'},'coefficients',{'d'})
Gives me the following error
Error using fittype/evaluate (line 106)
Error in fittype expression ==> (integral(@(xi)(
(1./pi.*(0.1375.*sqrt(2.*pi))).*exp(-(xi-2.75).^2./(2.0.*0.01890625))./((xval+0.09793600169767440.*2.*xi-1.34484937381768000).^2+d.^2)
),0,1./0))
??? Output of the function must be the same size as the input. If FUN is an array-valued integrand, set
the 'ArrayValued' option to true.
when i turn ArrayValued option on it gives another error
myfittype = fittype(...
'(integral(@(xi)( (1/pi*(0.1375*sqrt(2*pi)))*exp(-(xi-2.75).^2/(2.0*0.01890625))./((xval+0.09793600169767440*2*xi-1.34484937381768000).^2+d^2) ),''ArrayValue'',true,0,1/0))',...
'dependent',{'y'},'independent',{'xval'},'coefficients',{'d'})
it gives another error
Error using fittype/evaluate (line 106)
Error in fittype expression ==> (integral(@(xi)(
(1./pi.*(0.1375.*sqrt(2.*pi))).*exp(-(xi-2.75).^2./(2.0.*0.01890625))./((xval+0.09793600169767440.*2.*xi-1.34484937381768000).^2+d.^2)
),'ArrayValue',true,0,1./0))
??? A and B must be floating-point scalars.
i can't understand what's wrong with the expression since using it as a stand alone function doesn't produce errors.
Answers (0)
Categories
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!