1
6.26 A linear combination of three functions that is used for curve fitting has the form (see Section 6.8):
Write a MATLAB user-defined function that determines the coefficients , , and that best fits a
given set of data points. Name the function C = NonLinCombFit(F1,F2,F3,x,y), where the input argu-
ments F1, F2, and F3 are handles of the three functions (user-defined or anonymous) , , and
, and x and y are vectors with the coordinates of the data points. The output argument C is a three-
element row vector with the values of the coefficients , , and .
Use NonLinCombFit to solve Problem 6.40 (a). Write a program in a script file that uses NonLinComb-
Fit and plots the data points and the curve of that best fits the data.
Solution
The listing of the user-defined function NonLinCombFits is:
function c = NonLinCombFit(F1,F2,F3,x,y)
% NonLinComdFit determines the three coefficients C1, C2, C3 of the function
Fx() C1f1x() C2f2x() C3f3x()++=