Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please provide all Matlab code as well The goal of this project is to construct an interpolating polynomial that approximates the function f(x) tan(sin x3)
Please provide all Matlab code as well
The goal of this project is to construct an interpolating polynomial that approximates the function f(x) tan(sin x3) on the domain [0, 3]. You can use any method to compute the polynomial (including the code on Blackboard from March 27) 1. The Matlab command x0-3 (0: (n-1) ) / (n-1); defines n equally-spaced base points in the interval [0, 3]. Take y0 values from the function f (x) at these x0 coordinates, using exact values from Matlab's trig functions. Find the degree n - 1 interpolating polynomial P,-1(x) that passes through the n points. Plot the actual f(x) versus P-1(x) on [0, 3 for n - 7. (Use a grid of width 0.01 or less to get a good plot.) Include the interpolating points, plotted as circles. In a separate figure, plot the interpolation error |f (x)- P6(x)on [0, 3], using Matlab's semilogy command. Estimate the maximum interpolation error on the domain [0, 3] 2. How small can you make the maximum interpolation error on the domain [0, 3? Find the n that makes it as small as possible. For this n, show the same two plots as in Step 1, the interpolation plot and the semilog interpolation error plot. Where along the interval [0, 3] is the error typically the largest? 3. Change the base points from equally-spaced to the "Chebyshev points" on [0, 3], and redo Step 2. Show the same two plots for your best n. You can replace the command above by the Matlab command x0-3/2+3/2 cos ( (1:2:2*n-1) xpi/ (2*n)) to use the Chebyshev points. 4. What can you say about the comparison between interpolation with equally-spaced base points (Step 2) and Chebyshev points (Step 3)? 5. Why do you think the error eventually gets larger if you continue to increase n? If you make n very large you should see some Warnings in the Matlab command line, what do you think is causing these? The goal of this project is to construct an interpolating polynomial that approximates the function f(x) tan(sin x3) on the domain [0, 3]. You can use any method to compute the polynomial (including the code on Blackboard from March 27) 1. The Matlab command x0-3 (0: (n-1) ) / (n-1); defines n equally-spaced base points in the interval [0, 3]. Take y0 values from the function f (x) at these x0 coordinates, using exact values from Matlab's trig functions. Find the degree n - 1 interpolating polynomial P,-1(x) that passes through the n points. Plot the actual f(x) versus P-1(x) on [0, 3 for n - 7. (Use a grid of width 0.01 or less to get a good plot.) Include the interpolating points, plotted as circles. In a separate figure, plot the interpolation error |f (x)- P6(x)on [0, 3], using Matlab's semilogy command. Estimate the maximum interpolation error on the domain [0, 3] 2. How small can you make the maximum interpolation error on the domain [0, 3? Find the n that makes it as small as possible. For this n, show the same two plots as in Step 1, the interpolation plot and the semilog interpolation error plot. Where along the interval [0, 3] is the error typically the largest? 3. Change the base points from equally-spaced to the "Chebyshev points" on [0, 3], and redo Step 2. Show the same two plots for your best n. You can replace the command above by the Matlab command x0-3/2+3/2 cos ( (1:2:2*n-1) xpi/ (2*n)) to use the Chebyshev points. 4. What can you say about the comparison between interpolation with equally-spaced base points (Step 2) and Chebyshev points (Step 3)? 5. Why do you think the error eventually gets larger if you continue to increase n? If you make n very large you should see some Warnings in the Matlab command line, what do you think is causing theseStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started