We can use the polyfit
function in MATLAB to find the best-fitting function of the given form using the least-squares method. We will also use polyval
function to evaluate the function at -10.
Here's an example code:
main.m226 chars9 lines
In your case, we will just replace the t
and y
vectors with the data points from the given function.
main.m209 chars9 lines
The value of the best-fitting function at -10 is stored in the variable result
.
gistlibby LogSnag