Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here is the MATLAB solution below for the question above. I need to change the code below to something else, but I need the solutions

image text in transcribed

Here is the MATLAB solution below for the question above. I need to change the code below to something else, but I need the solutions to match each other. (Also try not to copy answer posted on chegg already)

clc; clear all; close all; % reset matlab w N = [6,11,16,21,26,31]; for k=1:6 n = N(k); t = linspace(-1, 1, n)'; y = 1 ./ (1 + 25*t.^2); % A = []; % for i=1:n % for j=1:n % A(i,j) = t(i)^(j-1); % end %end A = fliplr(vander(t)); x = A\y; t_pol = linspace(-1, 1, 300)'; y_pol = polyval(flip(x),t_pol); figure; plot(t,y,'*','linewidth',2); hold on; plot(t_pol,y_pol,'linewidth',2); grid on; ylim([-.5 2.5]) legend 'Actual Data' 'Polynomial Fitting' end % One would expect that increasing the order would increase the accuracy of the fitting around the %center, but for the function considered here, the fitting is less stable on the sides of the plot, the bounds. % If a function has ill-behaved higher derivatives, then the quality of the % polynomial interpolation may actually decrease as the degree of the polynomial % increases.

3.1 Polynomial inlerpolation. In this problem we construet polynomials of degree 5, 10, and 15 (i.e., for 6, 16), that interpolate points on the graph of the funetion () 1+25t2) in the interval |-,or each value of n, we compute the interpolating polynomial as follows. We first generate n pnirs (4.%), using the MATLAB eommands t-inspace(1 1, n) y-1/ (25..2); l his produex wvo T-wDetors: a vector 1 with elernenus 4, equally spliced in 1 1,1 Are1a vector y with elementsy, J(1.). (Stv,'help rdivide' and 'help power, for the meaning ofthe operations . / ard .*) We then solve a sel of linear equations Vn-1 Va to find the coeflicients Calculate the thre polynonials (for n 6, 11,6). Plot the three polynomials and the function s on the interval-1,1, and attach a printout of the plots to your solutions. What do you conclude about the edfect of incrensing the degree of the interpolating polynomial? MATLAB hints. . Use x-A \ b to solvell set of n linear oquations inn variables A b. . "It) construct the coefficient matrix in (1), you can write al double for-loop, or use the built-in MATI.AB function vander, which constructs a matrix of the form Type 'help vander for detail8. This is almost what we need, but you have to lip' this matrix from left to right. This operation is also built in in MATLAB (type help fliplr). We are interested in the behavior of the interpolating polynomials between the points t that you used in the construction. Theresore, when you plot the three polynomials, you should use a much denser grid of points (e.g., a few hundred points equally spaced in interval -1, than the n points that you used to generate the polynomials

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Object Databases The Essentials

Authors: Mary E. S. Loomis

1st Edition

020156341X, 978-0201563412

More Books

Students also viewed these Databases questions

Question

17-4 List the steps in the selling process 320326

Answered: 1 week ago

Question

5. How do instructional objectives help learning to occur?

Answered: 1 week ago

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago