How do I specify a model asa FITTYPE object and not as a function using the Curve Fitting Toolbox?
1 view (last 30 days)
Show older comments
How do I specify a model asa FITTYPE object and not as a function using the Curve Fitting Toolbox?
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
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% confidence bounds):
a = -0.02444 (-0.1812, 0.1323)
b = 0.2505 (-0.677, 1.178)
0 Comments
More Answers (0)
See Also
Categories
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!