To compute the best fitting function of the form f(t) = a/t + bt using the least squares method in MATLAB, we can follow these steps:
t and f.A with two columns, where the first column is 1./t and the second column is t.A \ f) to compute the least squares solution x such that Ax is closest to f in a mean squared error sense.a and b from x.f at t = -7 using the computed coefficients.Here's the MATLAB code to implement these steps:
main.m146 chars9 lines
The computed value of f(-7) is stored in the variable f_eval.
gistlibby LogSnag