How is it possible that a fitobject can used as an input for the plot function?

1 view (last 30 days)
How is it possible that a fitobject can used as an input for the plot function?

Answers (1)

Titus Edelhofer
Titus Edelhofer on 17 Sep 2015
That's because the fit object has a method called plot:
x = fit([1 2 3]', [4 5 6.5]', 'linear')
x =
Linear interpolant:
x(x) = piecewise polynomial computed from p
Coefficients:
p = coefficient structure
You can use which to find out:
which plot(x)
C:\MATLAB\R2015b\toolbox\curvefit\curvefit\@cfit\plot.m % cfit method
Other objects define a plot method as well:
which -all plot
built-in (C:\MATLAB\R2015b\toolbox\matlab\graph2d\plot)
C:\MATLAB\R2015b\toolbox\curvefit\curvefit\@cfit\plot.m % cfit method
C:\MATLAB\R2015b\toolbox\matlab\graphfun\@graph\plot.m % graph method
C:\MATLAB\R2015b\toolbox\matlab\graphfun\@digraph\plot.m % digraph method
C:\MATLAB\R2015b\toolbox\matlab\polyfun\@alphaShape\plot.m % alphaShape method
C:\MATLAB\R2015b\toolbox\matlab\timefun\@duration\plot.m % duration method
C:\MATLAB\R2015b\toolbox\matlab\timefun\@datetime\plot.m % datetime method
C:\MATLAB\R2015b\toolbox\curvefit\curvefit\@sfit\plot.m % sfit method
C:\MATLAB\R2015b\toolbox\finance\ftseries\@fints\plot.m % fints method
C:\MATLAB\R2015b\toolbox\ident\ident\@iddata\plot.m % iddata method
C:\MATLAB\R2015b\toolbox\ident\nlident\@idnlhw\plot.m % idnlhw method
C:\MATLAB\R2015b\toolbox\ident\nlident\@idnlarx\plot.m % idnlarx method
C:\MATLAB\R2015b\toolbox\robust\rctobsolete\robust\@frd\plot.m % frd method
C:\MATLAB\R2015b\toolbox\signal\signal\@dspdata\plot.m % dspdata method
C:\MATLAB\R2015b\toolbox\stats\classreg\@LinearModel\plot.m % LinearModel method
C:\MATLAB\R2015b\toolbox\matlab\timeseries\@timeseries\plot.m % timeseries method
C:\MATLAB\R2015b\toolbox\wavelet\wavelet\@wdectree\plot.m % wdectree method
C:\MATLAB\R2015b\toolbox\wavelet\wavelet\@ntree\plot.m % ntree method
C:\MATLAB\R2015b\toolbox\wavelet\wavelet\@dtree\plot.m % dtree method
C:\MATLAB\R2015b\toolbox\wavelet\wavedemo\@wvtree\plot.m % wvtree method
C:\MATLAB\R2015b\toolbox\wavelet\wavedemo\@rwvtree\plot.m % rwvtree method
C:\MATLAB\R2015b\toolbox\wavelet\wavedemo\@edwttree\plot.m % edwttree method
Titus

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!