You can specify a FITTYPE object as your fit model in FIT function.
Use an object FITTYPE (different from CFIT). Here is an example which demsonstrates how to do this:
f1 = fittype('a*x+b')
f1 =
General model:
f1(a,b,x) = a*x+b
Now, you can use this model to fit different data set. For example:
x = 0:10; y = sin(x);
f2 = fit(x',y',f1)
f2 =
General model:
f2(x) = a*x+b
Coefficients (with 95
a = -0.02444 (-0.1812, 0.1323)
b = 0.2505 (-0.677, 1.178)
Best Answer