Question

I only need help with part C.

Problem 4 Computer Problem: Before beginning this problem, copy the file interppoly.a ile in the assignment folder to the dir

Below is interppoly.m

function [yout, cof] - interppoly(xin,yin, xout) % This function first determines the vector of coefficients cof % in the New

Problem 4 Computer Problem: Before beginning this problem, copy the file interppoly.a ile in the assignment folder to the directory you will be sing when you start up Matlab a): Let e, -[一6,5, Rr each degree n-4,8, 16, and 32, plt over the interval (내 the error function e(r)-f(r)-Po(x), where f(z-1/(1 +r') nd P() is the polynoenial of degree which interpolates f at the equally spaced interpolation points r +16-a),i0 Record the approx- imate maximum of e(z {as seen from the graph) for each and approxi- mately where it oecurs. To get you started, the case4 can be done by typing (or cutting and pasting) the following commands into Matlab Proble. 3a xin-linapace(a,b, in-1C1-xin. "2); yout, cof interppoly(xin,yin, xout) true+xout.2 plot(xout,ytrue yout) The other values of n ean be done by by entering a new value of n and then re-entering the other commans b): Repeat part (a), this time using the polynomial Qz) of degree S which interpolates f at the (Chebyshev) points To get you started, the case n = 4 can be dne by typing (r。tting atKI pasting) the following coenmands into Matlab % Problem 3b clea* a11 % cleaes Plotting vindoua yla /i+xia. "2) xout-linapace(a,b, 100; yout, cof] iaterpoly(xin,yin,xout) true-/Cirzout.2) plot (xout,ytrue-yout) c. Bad on your plots, does the choice of interpolation points makea difference in the in the appeoximation? Which cholee is better in this case?
function [yout, cof] - interppoly(xin,yin, xout) % This function first determines the vector of coefficients cof % in the Newton form of the interpolating polynomial of degree % less than or equal to n-1, i.e., the polynomial p(x) of degree % less than or equal to n-1 of the form % p(X) -cof(1) + cof (2 ) (X-Xin(1)) + cof(n)(x-xin(1)).. . (x-xin(n-1)) % satisfying p(Xin(i)) yin(i), i-1:n, % where the inputs xin and yin are vectors of length n % The function then determines the values % yout pCxout), where xout is a vector of length m n = length(Xin) for k-1 n-1 (xin(k+1:n) - xin(k)); end cof = yin; yout - cof(n)*ones(1, length(xout)); % ones(I'm) returns an 1-by-m matrix of 1s for k-n-1:-1:1 yout - (xout-xin(k)).*yout + cof(k); end
0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

Note: Brother in case you have any query or any confusion related to the answer then just comment. I will solve everything.

3)

As we can see that error in the first parts were

For n=4 max |e| is 0.438273
For n=8 max |e| is 1.045078
For n=16 max |e| is 14.013534
For n=32 max |e| is 4641.235473

Errors in the second part were

For n=4 max |e| is 0.401956
For n=8 max |e| is 0.170066
For n=16 max |e| is 0.032580
For n=32 max |e| is 0.001395

Which tells that for increasing number of points the first part x-values will give larger error for larger n but this is not the case in the other part which gives less error for larger n.

So, in this case second part interpolation is pretty better as the interpolated points chosen are far better than that of first part.

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
Problem 4 Computer Problem: Before beginning this problem, copy the file interppoly.a ile in the ...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT