In the case where the interpolating polynomial is

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: the problem of significant digits. What Matlab outputs to the computer screen and what it stores in its internal memory are two entirely different things. Return to the default output precision by typing the following command at the Matlab prompt. print doc >> format back close exit By default, Matlab displays floating point numbers with four decimal places. For example, if you enter x=1/7 at the prompt, Matlab responds with 0.1429. However, this is not what Matlab stores internally. Rather, Matlab stores the number in double precision. This strategy stores a lot more significant figures in memory than what is displayed on the screen. In the case where the interpolating polynomial is unique, there is a simple way to build the polynomial without entering the coefficients individually. Simply strip off the last column of the augmented matrix after it has been placed in reduced row echelon form. If the reduced row echelon form of the augmented matrix 10000 1 0 1 0 0 0 −2 R = 0 0 1 0 0 0 , 0 0 0 1 0 1 0 0 0 0 1 −4 then the command The Interpolating Polynomial title page contents >> p=R(:,6) will strip off the last column and store the result in the variable p. Of course, the last column contains the coefficients of the interpolating polynomial, so this is an extremely effective way to build the interpolating polynomial. Remember, even if only 4 decimal places are displayed, internally, Matlab keeps as many decimal places for each coefficient as possible. You can easily see this when you work this exercise if you enter the commands >> >> >> >> format p format long p There is one final problem students have encountered in the past when working this exercise. Polynomials can grow so quickly (not exponentially, but still pretty fast) that the scale is previous page next page back print doc close exit just too large to see the oscillating behavior of the interpolating polynomial as it wiggles through its data points. The axis command will help you construct a viewing window that highlights this local behavior of the i...
View Full Document

Ask a homework question - tutors are online