next up previous
Next: About this document Up: Exercise Previous: Exercise

Help

You need to form a 5 by 3 matrix A whose columns are square of the x values, x-values, and a column of ones. One way to do this is to type

tex2html_wrap_inline535

Note: Recall that the operations .* , .^ provide element wise multiplication and raising to a power.

Now in Ax=b the vector x is

tex2html_wrap_inline541

and b is the vector of y-values. So you can enter b=D(:,2).

Now you could form the system AX=b, and least square solution id the solution of the normal system tex2html_wrap_inline547.

To solve this system you may find tex2html_wrap_inline549 by typing

tex2html_wrap_inline551

For the rest of this problem you need to redefine the matrix A > Make sure first clear yur old variables. For example for part (ii) first column of A is the third powers of x-value, and so on.

2cm ii) Find a polynomial of degree three, tex2html_wrap_inline555 that best fits the points given above.

2cm

iii) Find a polynomial of degree four, tex2html_wrap_inline557 that best fits the points given above.

iv) Find a polynomial of degree five tex2html_wrap_inline559 that best fits the points given above.