1) Write a function divdiff in matlab. The function should read in two vectors x and...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1) Write a function divdiff in matlab. The function should read in two vectors x and y, and returns a table (a matrix) of the divided difference values. The prototype of the function is: function a = divdiff(x, y) tinput: x, y: the data set to be interpolated Soutput: a: a table for Newton's divided differences 2) Write a function called polyvalue, that reads in the table of divided difference values generated by the function divdiff, the x-vector, and a vector t. The output of the function should be the values of Newton't polynomial computed at points gives in the vector t. The prototype of the polyvalue function is function v = polyvalue (a, x, t) $ input: a = Newton's divided differences x = the ponts for the dataset, same as in divdiff t = the points where the polynomial should be evaluated 3) Test your Matlab functions in a and b using 11 equally spaced nodes on the interval [-5, 5] (>> x = -5:5 ), find the interpolating polynomial p of degree 10 for the function f (x) = (x2 + 1)-1. Plot the function f(x) using the matlab ezplot function. Then on the same plot (use hold on) plot p(x) at the 11 point. Does it work well or poor? explain why? 4) Now, use the cubic spline interpolation provided by the matlab functions spline and ppval to generate the interpolation assuming natural cubic spline. Plot the result on the same plot as in three. 5) Repeat (4), but now use clamped cubic spline instead. You can do that by differentiating the function and finding f'(-.5) and f'(.5). Plot the result on the same plot as in 3 and 4. Your final result should look something like the following figure. 1/(x2 + 1) actual 1 nodes interpolated 0.9 natural cubic ....clamped 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.10 -3 -2 -1 1 3. 2. m.m.m m.m.m mimo (x), What to turn in: Submit a zip file that contains the required matlab files that would generate a figure similar to the above figure. Explain which method is the best for this problem, natural cubic spline or clamped cubic spline or Newton's divided difference. 1) Write a function divdiff in matlab. The function should read in two vectors x and y, and returns a table (a matrix) of the divided difference values. The prototype of the function is: function a = divdiff(x, y) tinput: x, y: the data set to be interpolated Soutput: a: a table for Newton's divided differences 2) Write a function called polyvalue, that reads in the table of divided difference values generated by the function divdiff, the x-vector, and a vector t. The output of the function should be the values of Newton't polynomial computed at points gives in the vector t. The prototype of the polyvalue function is function v = polyvalue (a, x, t) $ input: a = Newton's divided differences x = the ponts for the dataset, same as in divdiff t = the points where the polynomial should be evaluated 3) Test your Matlab functions in a and b using 11 equally spaced nodes on the interval [-5, 5] (>> x = -5:5 ), find the interpolating polynomial p of degree 10 for the function f (x) = (x2 + 1)-1. Plot the function f(x) using the matlab ezplot function. Then on the same plot (use hold on) plot p(x) at the 11 point. Does it work well or poor? explain why? 4) Now, use the cubic spline interpolation provided by the matlab functions spline and ppval to generate the interpolation assuming natural cubic spline. Plot the result on the same plot as in three. 5) Repeat (4), but now use clamped cubic spline instead. You can do that by differentiating the function and finding f'(-.5) and f'(.5). Plot the result on the same plot as in 3 and 4. Your final result should look something like the following figure. 1/(x2 + 1) actual 1 nodes interpolated 0.9 natural cubic ....clamped 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.10 -3 -2 -1 1 3. 2. m.m.m m.m.m mimo (x), What to turn in: Submit a zip file that contains the required matlab files that would generate a figure similar to the above figure. Explain which method is the best for this problem, natural cubic spline or clamped cubic spline or Newton's divided difference. 1) Write a function divdiff in matlab. The function should read in two vectors x and y, and returns a table (a matrix) of the divided difference values. The prototype of the function is: function a = divdiff(x, y) tinput: x, y: the data set to be interpolated Soutput: a: a table for Newton's divided differences 2) Write a function called polyvalue, that reads in the table of divided difference values generated by the function divdiff, the x-vector, and a vector t. The output of the function should be the values of Newton't polynomial computed at points gives in the vector t. The prototype of the polyvalue function is function v = polyvalue (a, x, t) $ input: a = Newton's divided differences x = the ponts for the dataset, same as in divdiff t = the points where the polynomial should be evaluated 3) Test your Matlab functions in a and b using 11 equally spaced nodes on the interval [-5, 5] (>> x = -5:5 ), find the interpolating polynomial p of degree 10 for the function f (x) = (x2 + 1)-1. Plot the function f(x) using the matlab ezplot function. Then on the same plot (use hold on) plot p(x) at the 11 point. Does it work well or poor? explain why? 4) Now, use the cubic spline interpolation provided by the matlab functions spline and ppval to generate the interpolation assuming natural cubic spline. Plot the result on the same plot as in three. 5) Repeat (4), but now use clamped cubic spline instead. You can do that by differentiating the function and finding f'(-.5) and f'(.5). Plot the result on the same plot as in 3 and 4. Your final result should look something like the following figure. 1/(x2 + 1) actual 1 nodes interpolated 0.9 natural cubic ....clamped 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.10 -3 -2 -1 1 3. 2. m.m.m m.m.m mimo (x), What to turn in: Submit a zip file that contains the required matlab files that would generate a figure similar to the above figure. Explain which method is the best for this problem, natural cubic spline or clamped cubic spline or Newton's divided difference. 1) Write a function divdiff in matlab. The function should read in two vectors x and y, and returns a table (a matrix) of the divided difference values. The prototype of the function is: function a = divdiff(x, y) tinput: x, y: the data set to be interpolated Soutput: a: a table for Newton's divided differences 2) Write a function called polyvalue, that reads in the table of divided difference values generated by the function divdiff, the x-vector, and a vector t. The output of the function should be the values of Newton't polynomial computed at points gives in the vector t. The prototype of the polyvalue function is function v = polyvalue (a, x, t) $ input: a = Newton's divided differences x = the ponts for the dataset, same as in divdiff t = the points where the polynomial should be evaluated 3) Test your Matlab functions in a and b using 11 equally spaced nodes on the interval [-5, 5] (>> x = -5:5 ), find the interpolating polynomial p of degree 10 for the function f (x) = (x2 + 1)-1. Plot the function f(x) using the matlab ezplot function. Then on the same plot (use hold on) plot p(x) at the 11 point. Does it work well or poor? explain why? 4) Now, use the cubic spline interpolation provided by the matlab functions spline and ppval to generate the interpolation assuming natural cubic spline. Plot the result on the same plot as in three. 5) Repeat (4), but now use clamped cubic spline instead. You can do that by differentiating the function and finding f'(-.5) and f'(.5). Plot the result on the same plot as in 3 and 4. Your final result should look something like the following figure. 1/(x2 + 1) actual 1 nodes interpolated 0.9 natural cubic ....clamped 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.10 -3 -2 -1 1 3. 2. m.m.m m.m.m mimo (x), What to turn in: Submit a zip file that contains the required matlab files that would generate a figure similar to the above figure. Explain which method is the best for this problem, natural cubic spline or clamped cubic spline or Newton's divided difference. 1) Write a function divdiff in matlab. The function should read in two vectors x and y, and returns a table (a matrix) of the divided difference values. The prototype of the function is: function a = divdiff(x, y) tinput: x, y: the data set to be interpolated Soutput: a: a table for Newton's divided differences 2) Write a function called polyvalue, that reads in the table of divided difference values generated by the function divdiff, the x-vector, and a vector t. The output of the function should be the values of Newton't polynomial computed at points gives in the vector t. The prototype of the polyvalue function is function v = polyvalue (a, x, t) $ input: a = Newton's divided differences x = the ponts for the dataset, same as in divdiff t = the points where the polynomial should be evaluated 3) Test your Matlab functions in a and b using 11 equally spaced nodes on the interval [-5, 5] (>> x = -5:5 ), find the interpolating polynomial p of degree 10 for the function f (x) = (x2 + 1)-1. Plot the function f(x) using the matlab ezplot function. Then on the same plot (use hold on) plot p(x) at the 11 point. Does it work well or poor? explain why? 4) Now, use the cubic spline interpolation provided by the matlab functions spline and ppval to generate the interpolation assuming natural cubic spline. Plot the result on the same plot as in three. 5) Repeat (4), but now use clamped cubic spline instead. You can do that by differentiating the function and finding f'(-.5) and f'(.5). Plot the result on the same plot as in 3 and 4. Your final result should look something like the following figure. 1/(x2 + 1) actual 1 nodes interpolated 0.9 natural cubic ....clamped 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.10 -3 -2 -1 1 3. 2. m.m.m m.m.m mimo (x), What to turn in: Submit a zip file that contains the required matlab files that would generate a figure similar to the above figure. Explain which method is the best for this problem, natural cubic spline or clamped cubic spline or Newton's divided difference. 1) Write a function divdiff in matlab. The function should read in two vectors x and y, and returns a table (a matrix) of the divided difference values. The prototype of the function is: function a = divdiff(x, y) tinput: x, y: the data set to be interpolated Soutput: a: a table for Newton's divided differences 2) Write a function called polyvalue, that reads in the table of divided difference values generated by the function divdiff, the x-vector, and a vector t. The output of the function should be the values of Newton't polynomial computed at points gives in the vector t. The prototype of the polyvalue function is function v = polyvalue (a, x, t) $ input: a = Newton's divided differences x = the ponts for the dataset, same as in divdiff t = the points where the polynomial should be evaluated 3) Test your Matlab functions in a and b using 11 equally spaced nodes on the interval [-5, 5] (>> x = -5:5 ), find the interpolating polynomial p of degree 10 for the function f (x) = (x2 + 1)-1. Plot the function f(x) using the matlab ezplot function. Then on the same plot (use hold on) plot p(x) at the 11 point. Does it work well or poor? explain why? 4) Now, use the cubic spline interpolation provided by the matlab functions spline and ppval to generate the interpolation assuming natural cubic spline. Plot the result on the same plot as in three. 5) Repeat (4), but now use clamped cubic spline instead. You can do that by differentiating the function and finding f'(-.5) and f'(.5). Plot the result on the same plot as in 3 and 4. Your final result should look something like the following figure. 1/(x2 + 1) actual 1 nodes interpolated 0.9 natural cubic ....clamped 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.10 -3 -2 -1 1 3. 2. m.m.m m.m.m mimo (x), What to turn in: Submit a zip file that contains the required matlab files that would generate a figure similar to the above figure. Explain which method is the best for this problem, natural cubic spline or clamped cubic spline or Newton's divided difference.
Expert Answer:
Answer rating: 100% (QA)
Mtlb de fr Newtn divide differene frmultin ler ll lse ll funtin fr whih interltin hve t d fx x211 ll ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
(a) Show that, for all vectors x and y in an inner product space, ||x + y||2 + ||x - y||2 = 2 (||x||2 + ||y||2). (b) Interpret this result pictorially for vectors in R2 under the Euclidean norm.
-
Find vectors x and y in R2 that are orthonormal with respect to the inner product (u, v) = 3u1v1 + 2u2v2 but are not orthonormal with respect to the Euclidean inner product.
-
Find vectors x and y with ||x|| s = 1 and ||y|| m = 1 such that ||A|| 1 = ||Ax|| s and ||A|| = ||Ay|| m , where A is the matrix in the given exercise. Exercise 23 Data From Exercise 23 A = 3
-
WiCom Servicing completed these transactions during November 2020, its first month of operations: Required 1. Prepare journal entries to record the transactions. Use general journal page 1. 2. Set up...
-
A family has six children. If this family has exactly two boys, how many different birth and gender orders are possible?
-
a. Explain the materiality and audit risk associated with the personnel services cycle. b. What is the auditor's usual audit strategy for this cycle? Why?
-
Assume that the expected rate of return for a stock with a beta of 1.1 is 12 percent and that the risk-free rate is 4 percent. What is the expected market risk premium? a. 6.48% b. 7.27% c. 10.48% d....
-
Harolds Roof Repair has provided the following data concerning its costs: For example, wages and salaries should be $21,380 plus $15.80 per repair-hour. The company expected to work 2,500...
-
7) 15 points House prices: Data from the National Association of Realtors Indicates that the mean price of a home in Denver, Colorado, In 2012 was 260.7 thousand dollars. A random sample of 70 homes...
-
LOT is a partnership owned by Long, Oliver, and Taker. The partners' profit-and loss- sharing ratio is 2:2:1, respectively. The adjusted trial balance of the partnership at November 30, 2018,...
-
The following information is available for Pyle Garage for March, Year 2 : BANK STATEMENT HAZARD STATE BANK 2 1 5 MAIN STREET HAZARD, GA 3 0 3 2 1 Pyle Garage 6 2 9 Main Street HAZARD, GA 3 0 3 2 1...
-
1) If a company has fixed costs of $6,000 per month and their product that sells for $200 has a contribution margin ratio of 30%, how many units must they sell in order to break even? 2) A company...
-
Big Bird uses the gross profit method to estimate inventory for monthly reporting purposes. Presented below is information for the month of July. Sales revenue $620,000 Inventory, July 1 99,200...
-
S On June 30, 2024, Georgia-Atlantic, Incorporated leased warehouse equipment from Builders, Incorporated The lease agreement calls for Georgia-Atlantic to make semiannual lease payments of $681,881...
-
SONARs are devices typically used in fishing boats. SONAR stands for Sound NAvigation Ranging, and a sonar device sends pulses of sound waves down through the water. When these pulses hit objects...
-
Following are transactions for Ridge Company. March 21 Accepted a $9,500, 180-day, 8% note from Tamara Jackson in granting a time extension on her past-due account receivable. September 17 Jackson...
-
The units of an item available for sale during the year were as follows: Jan. 1 Inventory 50 units at $110 Mar. 10 Aug. 30 Purchase 70 units at $118 Purchase 20 units at $124 Dec. 12 Purchase 60...
-
When a company has a contract involving multiple performance obligations, how must the company recognize revenue?
-
In the ice cream cone shown, L = 4 in. and e = 35°. The cone is filled with ice cream such that the portion above the cone is a hemisphere. Determine the volume of the ice cream. L
-
Two vectors are given: u = 5i - 6j + 9k and v = 11i + 7j - 4k Use MATLAB to calculate the dot product u v of the vectors in three ways: (a) Write an expression using element-by-element calculation...
-
Given: x sin axdx = sin ax/a2 x cos ax/a. Use MATLAB to calculate the following definite integral: /33x/2 x sin(0.6x)dx.
-
Copy, the verbal portion of advertising, is used to move readers through a persuasive sequence called AIDA: attention, interest, desire, and action. To achieve this, some copywriters have adopted...
-
How does a direct access file processing system edit individual transactions? a. takes place in a separate computer run b. takes place on-line mode as transactions are entered c. takes place during a...
-
Which of the following is an example of an input control? a. making sure that output is distributed to the proper people b. monitoring the work of programmers c. collecting accurate statistics of...
Study smarter with the SolutionInn App