Question

Problem 2. Given the data points (xi. yi), with xi 2 02 4 yil 5 1 1.25 find the following interpolating polynomials, and use

0 1
Add a comment Improve this question Transcribed image text
Answer #1

P, P) lundtiay limea Aunt 与十(M2) ( 1) -0.25 1-25-025(a-1 二 x-2)に7-1)40 321.25-5 25 = 125-1 ·25 Or -2-1 ple )1 035 2 .ttrom)가 Ljn シMatlab Code

x=[-2 0 1 2 4];
y=[5 1 1.25 1 -7];
plot(x,y)

Output

4 -2 -4 -6 -8 -2 4

(a)Linear Lagrange interpolation

x=linspace(-2,4);
if -2<=x<0
y=6+x/2;
end
if 0<=x<1
y=1+x/8;
end
if 1<=x<2
y=1.5-0.25*x;
end
if 2<=x<4
y=9-4*x;
end
plot(x,y)

Output

20 15 10 -5 -10 -2 4

(b)

x=linspace(-2,4);
if -2<=x<=1
y=(x.^2+2*x)*(1.25/3)+(5/6)*(x.^2-x)-(1/2)*(x.^2+x-2);
end
if 1<=x<=4
y=(-7/3)*(x-1).*(x-2)+(1.25/3)*(x-2).*(x-4)-(1/2)*(x-1).*(x-4);
end
plot(x,y)

Output

-5 -10 -15 20 -25 -30 -2 -1

(c)

x=linspace(-2,4);
y=5-2*(x+2)+0.25*x.*(x+2)-x.*(x-2).*(x+2)*(0.09375)-x.*(x+2).*(x-1).*(x-2)*(0.12326);
plot(x,y)

0 -5 -10 -15 20 -25 L -2 4 -1

Add a comment
Know the answer?
Add Answer to:
Problem 2. Given the data points (xi. yi), with xi 2 02 4 yil 5 1 1.25 find the following interpo...
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