%% Fit Power Series Models Using the fit Function
% This example shows how to use the fit function to fit power series models to data.
% The power series library model is an input argument to the fit and fittype functions. Specify the model type 'power1' or 'power2' .
%% Fit a Single-Term Power Series Model

load hahn1;
f = fit(temp,thermex,'power1')
plot(f,temp,thermex)

%
%% Fit a Two-Term Power Series Model

f = fit(temp,thermex,'power2')
plot(f,temp,thermex)

% Copyright 2015 The MathWorks, Inc.