From: Stephen on
Hi there:

I am attempting to fit a set of data to a model specified by a function I have written. In this function, the dependent variable x appears only as the upper limit of integration of a numerical integral performed by dblquad. This function works just fine normally. However, when I attempt to run fittype to form a model from my function, I get an error message stating that dblquad's limits of integration must be scalars. This indicates to me that the curve-fitting toolbox requires that you use vector functions only for your model, and that any function that is scalar only can't be fit. Is there a straightforward work-around to this problem, or will I have to start from scratch and write my own fitting routine?
From: Steven Lord on

"Stephen " <segals_remove.this_(a)colorado.edu> wrote in message
news:hc2ija$p37$1(a)fred.mathworks.com...
> Hi there:
>
> I am attempting to fit a set of data to a model specified by a function I
> have written. In this function, the dependent variable x appears only as
> the upper limit of integration of a numerical integral performed by
> dblquad. This function works just fine normally. However, when I attempt
> to run fittype to form a model from my function, I get an error message
> stating that dblquad's limits of integration must be scalars. This
> indicates to me that the curve-fitting toolbox requires that you use
> vector functions only for your model, and that any function that is scalar
> only can't be fit.

Yes ...

> Is there a straightforward work-around to this problem, or will I have to
> start from scratch and write my own fitting routine?

but you can write your object function to loop over the elements of its
input, or use ARRAYFUN to do something similar.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ