Question: Least Squares to Fit Curve

From some scientific experiments, the following set of data is available
(1.0, 2.33),(2.0, 0.0626),(3.0, −2.16),(4.0, −2.45),(5.0, −0.357),(6.0, 2.21),(7.0, 2.75),(8.0, 0.636),(9.0, −2.45).

We need to use least squares method to fit the curve to the data
y = a + b cos(x) + c sin(x) + d cos(2x) + e sin(2x)


Show your solution procedure in Maple and get the best fit for the coefficients. Finally
plot the data and the y curve together on the same graph to visualize the fitting. For the
data, use blue circles while for the y curve, use red solid line style. Use the leastsquares
command we learned in LinearAlgebra package.

Please Wait...