I'm trying to get my program to provide the best polynomial interpolation fit with the given degree n.
And I'm not allowed by my professor to use High-level curve fitting functions in my function or algorithm.
He said I could use other basic Matlab functions such as fprintf, error, linspace, as well as all linear algebra features, including the
backslash operator.
He wants my code to produce a smooth graph, with interpolation points (shown as circles) and the vector-defined evaluation points (shown as plus-signs).
He says the curve should be generated by my code, and it should use enough points to make a smooth curve.
He also say to ensure that my code will work for non-trivial (non-polynomial) cases.
I need help writing this function. Below is what I've worked on so far.
I have made my inputs:
interpolation point x-values – x
Interpolation point y-values – y
Order of polynomial interpolation – n
Evaluation point location – Ex
And my output is:
Evaluation point levels – Ey
And this is the code I have so far:
function [Ey] = HuckabeeJCurveFit(x,y,n,Ex)
error('x and y must be the same length');
product = product*(Ex-x(j))/(x(i)-x(j));