From: Daniel on
How can I use a function handle / anonymous function for fittype:

f = @(x,a) a+x;
fittype('f(x,a)')

??? Error using ==> fittype.fittype>fittype.fittype at 477
Expression f(x,a) is not a valid MATLAB expression,
has non-scalar coefficients, or cannot be evaluated:
Error in fittype expression ==> f(x,a)
??? Undefined function or method 'f' for input arguments of type
'double'.
From: Steven_Lord on


"Daniel " <danengel1(a)gmail.com> wrote in message
news:i3ggft$aj7$1(a)fred.mathworks.com...
> How can I use a function handle / anonymous function for fittype:
>
> f = @(x,a) a+x;
> fittype('f(x,a)')

I don't believe FITTYPE supports specifying a function handle as the
expression to be fit. For that I'd probably use LSQCURVEFIT from
Optimization Toolbox instead of FIT and FITTYPE from Curve Fitting Toolbox.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

From: Daniel on
Wow, that was a quick reply, and a useful one too. Thank you very much!
 | 
Pages: 1
Prev: Fill Command?
Next: how can use the "solve"