The concept of curve fitting is slightly different from interpolation. In the case of the interpola-
tion, we try to find the piecewise approximation of a function between two data points. On the
other hand, in curve fitting, the objective is to determine a single approximate equation for the
whole range of given data. The MATLAB function polyfit is the most elementary method of
curve fitting, where the coefficients of the best fit polynomial are determined based on mini-
mizing least squares error for the given data points. Example 6.6 presents a simple usage of
polyfit.
Figure 6.2 A coarse plot for z defined in ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.