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...
-
Economists Henry Saffer of Kean University, Frank J. Chaloupka of the University of Illinois at Chicago, and Dhaval Dave of Bentley College estimated that the government must spend $4,170 on drug...
-
A Pitot tube on an airplane flying at standard sea level reads 1.07 x 105 N/m2. What is the velocity of the airplane?
-
When conducting an incremental analysis, what step must always be taken immediately prior to beginning the pairwise comparisons? a. Order the alternatives from highest to lowest initial investment b....
-
On January 1, 2011, Perry Company purchased 8,000 shares of Soho Companys common stock for $120,000. Immediately after the stock acquisition, the statements of financial position of Perry and Soho...
-
What are the differences between the Enterprise Edition, Standard Edition, and Standard Edition One installation types of Oracle Database. Which one would be suitable for a small business or a...
-
Sunnyville Bank wants to identify customers who may be interested in its new mobile banking app. The worksheet called Mobile_Banking_Data contains 500 customer records collected from a previous...
-
Given data below to solve these questions. 1. A. Initial investment: $125,000 Sound Cellar Pro Gamer Net Cash Cumulative Net Net Cash Cumulative Net Flow Cash Flows Flow Cash Flows Year 1 $ 65,000 $...
-
Scenario: You are working for a company that is hoping to adapt a short story into a film. Your supervising director had not read "The Happy Prince" by Oscar Wilde, and since she doesn't have time to...
-
Explain the Corporate and Competitive Strategic of Commercial Bank of Qatar based on SWOT Analysis of Commercial bank of Qatar ? with explain each of the SWOT analysis in the competitive Strategic of...
-
Indicate how each business transaction affects the basic accounting equation. (a) Paid cash for janitorial services. Increase Assets and Increase Stockholders EquityIncrease Assets and Decrease...
-
An airplane flies at a velocity of 220 m/s directly east over Palm Beach. Genevieve, a passenger on the airplane, runs towards the back of the airplane at 5 m/s. At the same instant, Lauren drives...
-
What category of procurement is for something new that does not already exist and incurs significant developmental and capital expense on both sides?
-
What is the name of the accounting standards issued by the IASB? Select one: a. Financial Reporting Standards b. International Accounting Standards c. International Reporting Standards d....
-
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.
-
Use the Ritz variational method for the harmonic oscillator, with trial wave functions \(\psi_{1}(x)=\) \(e^{-y^{2} / 2}, \psi_{2}(x)=e^{-y^{2}}, \psi_{3}(x)=e^{-2 y^{2}}\), where \(y=x \sqrt{m...
-
Consider a two-level system, with basis \(|1angle,|2angle\), and in this basis, a Hamiltonian with elements \(\left(\begin{array}{ll}1 & 1 \\ 1 & 1\end{array} ight)\). Use the first form of the...
-
Use the practical variational method for the same harmonic oscillator ground state energy, with trial wave function \(\psi_{a}(x)=e^{-a y^{2}}\).
Oracle Adf Enterprise Application Development Made Simple 1st Edition - ISBN: 1849681880 - Free Book
Study smarter with the SolutionInn App