mm245/ma260 lab3


http://www.maths.nuigalway.ie/~gettrick/teach/mm245/labs/l3.html




Spend 30 minutes familiarizing yourself with polynomials in OCTAVE/SCILAB/MATLAB. You can search online for any of the tutorials or documentation on MATLAB/SCILAB/OCTAVE, or read http://www.engin.umich.edu/group/ctm/basic/basic.html#polynomial or http://www.matrixlab-examples.com/polynomials.html.

You should study (and run) the code in poly1.m at http://www.maths.nuigalway.ie/~gettrick/teach/mm245/labs/matlab/ which is commented to explain its operation.

For this lab Consider the function 3**x - x (for example, for x=2, the y value is 3**2 - 2 = 7). For the x values of 2, 3 and 4:

  1. determine the corresponding y values.
  2. calculate the Lagrange Interpolating polynomial (of degree 2) for these 3 points.
  3. determine the relative error at x=3.5
For the same function, calculate the Lagrange Interpolating polynomial (of degree 1) if we only consider two points x=2 and x=3. Again, calculate the relative error at x=3.5.

© NUI, Galway