lagrange interpolation only requires 2 arrays: some X and Y. This generates a Z vector and x_vector which can be applied to the "err" file. It calculates the error using the trapezoidal method between Z and function F, which is given in the file (can edit).
File list:
err.m
lagrange_poly.m