Question: MATLAB question: Consider the data points {(k, pk) | k Element N [1, 10]} where pk is the k^th prime (which can be calculated by
MATLAB question:
Consider the data points {(k, pk) | k Element N [1, 10]} where pk is the k^th prime (which can be calculated by primes). Find the unique polynomial p_9 (x) which passes through these points in two ways. a) Let p_9 (x) = c_1 + c_2 x + middot middot middot + c_9 x^8 + c_10 x^9 be the desired polynomial and write the matrix equation for p (k) = pk where k Element [1, 10]. Generate the matrix by using Vander. Solve this equation for the 10 coefficients. b) Use polyfit to calculate the coefficients. Compare these coefficients with the previous ones by tabulating them to full precision, as well as the difference between them. c) Plot the polynomial p_9 (x) for x Element [1, 10], including the data points as dots. Also plot this polynomial for x Element [0, 11], using subplot to put one above the other, and using the same horizontal endpoints. How close is p_9 (11) to the 11^th prime? Consider the data points {(k, pk) | k Element N [1, 10]} where pk is the k^th prime (which can be calculated by primes). Find the unique polynomial p_9 (x) which passes through these points in two ways. a) Let p_9 (x) = c_1 + c_2 x + middot middot middot + c_9 x^8 + c_10 x^9 be the desired polynomial and write the matrix equation for p (k) = pk where k Element [1, 10]. Generate the matrix by using Vander. Solve this equation for the 10 coefficients. b) Use polyfit to calculate the coefficients. Compare these coefficients with the previous ones by tabulating them to full precision, as well as the difference between them. c) Plot the polynomial p_9 (x) for x Element [1, 10], including the data points as dots. Also plot this polynomial for x Element [0, 11], using subplot to put one above the other, and using the same horizontal endpoints. How close is p_9 (11) to the 11^th prime
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
